GZIP无法在Amazon Cloudfront中运行(GZIP not working in Amazon Cloudfront)

编程入门 行业动态 更新时间:2024-10-27 14:18:04
GZIP无法在Amazon Cloudfront中运行(GZIP not working in Amazon Cloudfront)

我正在尝试在我的页面上加载压缩的javascript和css文件。 我的文件位于amazon s3服务器中,我已将Cloudfront Distribution配置为自动压缩对象。 即使在设置了Cloudfront Distribution之后,我仍然在我的页面上获取未压缩的文件,而不是Cloudfront应该加载的压缩文件。

我的Amazon s3服务器中的文件

https://s3.us-east-2.amazonaws.com/02242017-bucket1/animate.css

https://s3.us-east-2.amazonaws.com/02242017-bucket1/jssor.js

我的请求标题读取

Accept:*/* Accept-Encoding:gzip, deflate, sdch, br Accept-Language:en-US,en;q=0.8 Connection:keep-alive Host:s3.us-east-2.amazonaws.com Referer:http://test.sitepm.com/simplewebcontent/710/1/peterspage1 User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

我的响应标题是

Accept-Ranges:bytes Content-Length:58701 Content-Type:application/javascript Date:Tue, 28 Feb 2017 10:30:41 GMT ETag:"be74d5befb57a55bcf71d5af775f8dfb" Last-Modified:Fri, 24 Feb 2017 05:06:32 GMT Server:AmazonS3 x-amz-id-2:ioAxulBZpyxcqCAdvQ47uCuA2zwvh9wrUXA6yyPdL0dt9suwZWSHc8E0hrxte+cBd8kpQt4IYEI= x-amz-request-id:1FA844B6044B1E2A

我的Cloudfront Origin设置

任何人都可以告诉我,我在这里失踪了......

I am trying to load compressed javascript and css files on my page. My files are in the amazon s3 server and I have configured the Cloudfront Distribution to Compress Objects Automatically. Even after setting up the Cloudfront Distribution, I am still getting the uncompressed files on my page instead of the compressed ones that Cloudfront should be loading.

Files in my Amazon s3 server

https://s3.us-east-2.amazonaws.com/02242017-bucket1/animate.css

https://s3.us-east-2.amazonaws.com/02242017-bucket1/jssor.js

My Request Header reads

Accept:*/* Accept-Encoding:gzip, deflate, sdch, br Accept-Language:en-US,en;q=0.8 Connection:keep-alive Host:s3.us-east-2.amazonaws.com Referer:http://test.sitepm.com/simplewebcontent/710/1/peterspage1 User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

My Response Header is

Accept-Ranges:bytes Content-Length:58701 Content-Type:application/javascript Date:Tue, 28 Feb 2017 10:30:41 GMT ETag:"be74d5befb57a55bcf71d5af775f8dfb" Last-Modified:Fri, 24 Feb 2017 05:06:32 GMT Server:AmazonS3 x-amz-id-2:ioAxulBZpyxcqCAdvQ47uCuA2zwvh9wrUXA6yyPdL0dt9suwZWSHc8E0hrxte+cBd8kpQt4IYEI= x-amz-request-id:1FA844B6044B1E2A

My Cloudfront Origin Settings

Can anyone tell me what I am missing here...

最满意答案

您可能已配置CloudFront分配,但基于这些请求和响应标头,您实际上并未通过CloudFront请求对象。

请求:

Host:s3.us-east-2.amazonaws.com

这显然不是CloudFront主机名,例如dxxxexample.cloudfront.net ,而不是自定义域中的主机名...您直接从S3请求此主机名。

响应:

如果此请求X-Amz-Cf-Id CloudFront处理,则响应标头Via和X-Cache以及X-Amz-Cf-Id将存在,但它们不存在。

You may have configured a CloudFront distribution, but based on these request and response headers, you're not actually requesting the objects through CloudFront.

Request:

Host:s3.us-east-2.amazonaws.com

This is obviously not a CloudFront hostname, e.g. dxxxexample.cloudfront.net, and not a hostname from a custom domain... You're requesting this directly from S3.

Response:

If this request had been processed by CloudFront, the response headers Via and X-Cache and X-Amz-Cf-Id would be present, but they are not.

更多推荐

本文发布于:2023-08-02 07:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1370054.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Amazon   GZIP   working   Cloudfront

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!