CloudFront 得到 X-Cache:来自云端的错误,状态代码为 200
CloudFront got X-Cache: Error from cloudfront with Status Code 200
我正在尝试使用具有两个 S3 来源的 CloudFront 来托管我的网站 example.com
。S3-main
用于网站,S3-resources
用于资源。
所以我设置S3-main
为default(*)
。 S3-resources
路径模式 resources/*
.
当我去 https://example.com 时,我在 S3-main
下成功加载了 index.html
但是当我尝试 GET https://example.com/resorces/something.jpg
时,我又得到了 https://example.com/index.html
和 header 如下所示:
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-Cache: Error from cloudfront
?
为什么我得到的是 index.html
而不是我预期的 something.jpg
?
备注
我可以通过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 |
+--------------------+
检查您的分发设置...特别是“错误页面”选项卡。
如果您配置了自定义错误响应,这听起来像是您配置不正确。发生错误时可以替换内容 和 重写 HTTP 状态代码,并且您报告的行为将与此类(错误)配置完全一致。
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html
我正在尝试使用具有两个 S3 来源的 CloudFront 来托管我的网站 example.com
。S3-main
用于网站,S3-resources
用于资源。
所以我设置S3-main
为default(*)
。 S3-resources
路径模式 resources/*
.
当我去 https://example.com 时,我在 S3-main
下成功加载了 index.html
但是当我尝试 GET https://example.com/resorces/something.jpg
时,我又得到了 https://example.com/index.html
和 header 如下所示:
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-Cache: Error from cloudfront
?
为什么我得到的是 index.html
而不是我预期的 something.jpg
?
备注
我可以通过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 |
+--------------------+
检查您的分发设置...特别是“错误页面”选项卡。
如果您配置了自定义错误响应,这听起来像是您配置不正确。发生错误时可以替换内容 和 重写 HTTP 状态代码,并且您报告的行为将与此类(错误)配置完全一致。
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html