我正在尝试在我的页面上加载压缩的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.36My 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:1FA844B6044B1E2AMy 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.comThis 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.
更多推荐
发布评论