简体   繁体   English

GZIP无法在Amazon Cloudfront中运行

[英]GZIP not working in Amazon Cloudfront

I am trying to load compressed javascript and css files on my page. 我想在我的页面上加载压缩的javascript和css文件。 My files are in the amazon s3 server and I have configured the Cloudfront Distribution to Compress Objects Automatically. 我的文件位于amazon s3服务器中,我已将Cloudfront Distribution配置为自动压缩对象。 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. 即使在设置Cloudfront Distribution之后,我仍然在我的页面上获取未压缩的文件,而不是Cloudfront应该加载的压缩文件。

在此输入图像描述

Files in my Amazon s3 server 我的Amazon s3服务器中的文件

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

https://s3.us-east-2.amazonaws.com/02242017-bucket1/jssor.js 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 我的Cloudfront Origin设置 在此输入图像描述

Can anyone tell me what I am missing here... 任何人都可以告诉我这里缺少什么......

You may have configured a CloudFront distribution, but based on these request and response headers, you're not actually requesting the objects through CloudFront. 您可能已配置CloudFront分配,但基于这些请求和响应标头,您实际上并未通过CloudFront请求对象。

Request: 请求:

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

This is obviously not a CloudFront hostname, eg dxxxexample.cloudfront.net , and not a hostname from a custom domain... You're requesting this directly from S3. 这显然不是CloudFront主机名,例如dxxxexample.cloudfront.net ,而不是自定义域中的主机名......您直接从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. 如果此请求已由CloudFront处理,则响应标头ViaX-Cache以及X-Amz-Cf-Id将存在,但它们不存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM