【问题标题】:AWS CloudFront automatic compression doesn't workAWS CloudFront 自动压缩不起作用
【发布时间】:2018-04-09 22:36:48
【问题描述】:

今天我想为我的 S3 存储桶启用 AWS CloudFront 自动压缩,因为 Google PageSpeed Insights 建议这样做。所以我做了什么: - 去云端,选择分发,编辑行为设置,启用“自动压缩对象”; - 等待分发重新部署。

之后,我从我的页面检查了对 s3 存储桶的请求。

Request headers:

:authority:******.com
:method:GET
:path:/app.min.js
:scheme:https
accept:*/*
accept-encoding:gzip, deflate, br
accept-language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4,da;q=0.2
cache-control:no-cache
cookie:_ga=GA1.2.1335221784.1504949270; _gid=GA1.2.1414665009.1509096143
pragma:no-cache
referer:https://****.com/index.html
user-agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Response headers:

age:1507
content-length:633168
content-type:application/javascript
date:Thu, 26 Oct 2017 10:05:44 GMT
etag:"45078c31177a2c0aa98e2d97b014841e"
last-modified:Thu, 26 Oct 2017 09:58:14 GMT
server:AmazonS3
status:200
via:1.1 f96185b1d69d6f85635bc2b5554da639.cloudfront.net (CloudFront)
x-amz-cf-id:aOflZZwZTvtfNnm2gxOQGKMxZi-MVfuiTw9YhRxswoqU84L84Z3D-Q==
x-cache:Hit from cloudfront

似乎 CloudFront 进行自动压缩工作所需的所有标头都存在,但请求加载速度和文件大小都没有减小。 Google PageSpeed Tool 仍然建议启用自动压缩。 有什么建议吗?

【问题讨论】:

    标签: amazon-s3 gzip amazon-cloudfront


    【解决方案1】:

    问题已解决。我必须使分发的云端缓存无效,因为云端不会压缩已经在缓存中的对象。

    【讨论】:

      猜你喜欢
      • 2018-04-19
      • 2017-06-17
      • 2018-06-25
      • 1970-01-01
      • 1970-01-01
      • 2015-05-22
      • 2011-04-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多