CloudFront收到了X-Cache:来自Cloudfront的错误,状态码为200 [英] CloudFront got X-Cache: Error from cloudfront with Status Code 200

查看:216
本文介绍了CloudFront收到了X-Cache:来自Cloudfront的错误,状态码为200的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用具有两个S3来源的CloudFront托管我的网站 example.com S3-main 网站和 S3-resources 来获取资源。

I was trying to host my site example.com using CloudFront with two S3 origins.S3-main for the site and S3-resources for the resources.

所以我将 S3-main设置为作为默认值(*)。还有 S3-resources 和路径模式 resources / *

So I set S3-main as the default(*). And S3-resources with path pattern resources/*.

当我走 https://example.com 时,我成功加载了 index.html S3-main

下的c $ c>但是当我尝试获取 https://example.com/resorces/ something.jpg 我再次得到 https://example.com/index.html ,标题如下:

When I go https://example.com I successfully loaded index.html under S3-main
But when I tried to GET https://example.com/resorces/something.jpg I got again https://example.com/index.html with header like below:

http GET https://example.com/resources/something.jpg

HTTP/1.1 200 OK
Accept-Ranges: bytes
Connection: keep-alive
Content-Length: 1518
Content-Type: text/html
Date: Thu, 17 Aug 2017 03:29:52 GMT
ETag: "9776b731a6c42de14c929c10b4fec28c"
Last-Modified: Thu, 17 Aug 2017 01:56:41 GMT
Server: AmazonS3
Via: 1.1 xxxxxxx.cloudfront.net (CloudFront)
X-Amz-Cf-Id: 3OVCtUAk8mGzKt2OJD5gX9KRLHG3CBSHXf-xxxxxxxx==
X-Cache: Error from cloudfront

我为什么得到 HTTP / 1 .1 200 OK X缓存:同时来自Cloudfront的错误
为什么我得到 index.html 而不是我期望的 something.jpg

Why did I get HTTP/1.1 200 OK and X-Cache: Error from cloudfront the same time? Why did I get index.html rather than something.jpg as I expected?

注意

我可以通过 S3-resources获取图像。 s3.amazonaws.com

http GET https://S3-resources.s3.amazonaws.com/resources/something.jpg

Accept-Ranges: bytes
Content-Length: 176182
Content-Type: image/jpeg
Date: Thu, 17 Aug 2017 04:11:55 GMT
ETag: "xxxxxxx84b05fb6564323c"
Last-Modified: Thu, 17 Aug 2017 02:59:12 GMT
Server: AmazonS3
x-amz-id-2: xxxx/xxxl+ijjM3YTxtQ4LpdHReEOhUvAz7uPFmVwzs8Foe4WOE=
x-amz-request-id: XXXX145CA3

+--------------------+
| NOTE: binary data  |
+--------------------+


推荐答案

检查您的分发设置...特别是错误页面选项卡。

Check your distribution settings... specifically, the Error Pages tab.

如果您配置了自定义错误响应,听起来您配置错误。发生错误时,可以替换内容重写HTTP状态代码,并且您报告的行为将与这种(错误)配置完全一致。

If you have configured custom error responses, it sounds like you have configured them incorrectly. It is possible to substitute content and rewrite the HTTP status code when an error occurs, and the behavior you are reporting would be exactly consistent with such a (mis)configuration.

http:// docs .aws.amazon.com / AmazonCloudFront / latest / DeveloperGuide / custom-error-pages.html

这篇关于CloudFront收到了X-Cache:来自Cloudfront的错误,状态码为200的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆