【问题标题】:Cloudfront Gzip compression not working with files on siteCloudfront Gzip 压缩不适用于现场文件
【发布时间】:2016-09-23 21:44:28
【问题描述】:

我已通过 Cloudfront 对我的行为启用 gzip 页面压缩。我已将以下标头列入白名单:

Authorization
Host
Origin
Referer

Cloudfront 未对相关文件进行 gzip 压缩。这是请求和响应标头。

为什么 gzip 不工作?标头具有 gzip 和 content-length 值,因此据我了解,这是云端的要求。

Request Header

Accept  text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

Accept-Encoding gzip, deflate, sdch

Accept-Language en-US,en;q=0.8

Cookie  SESSef4017ccd367c98fbaadc=56e41ddb0fc0e0235cf8c5f7f18;
_ga=GA1.2.1714162874.1474376389;

has_js=1

Upgrade-Insecure-Requests   1

User-Agent  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36


Response Header

Accept-Ranges   bytes

Age 25

Cache-Control   max-age=172800

Content-Length  614

Content-Type    text/css

Date    Wed, 21 Sep 2016 16:04:28 GMT

Expires Fri, 23 Sep 2016 16:04:28 GMT

Last-Modified   Wed, 16 Jan 2013 21:09:10 GMT

Server  Apache

Via 1.1 xxxx.cloudfront.net (CloudFront)

X-Amz-Cf-Id xxxxxxxxxxZ3lir8aOV5mykyezionEw==

X-Cache Hit from cloudfront

【问题讨论】:

  • 我也在云端使文件无效,但仍然没有压缩
  • 有人想帮忙吗?谢谢!

标签: amazon-web-services amazon-ec2 amazon-cloudfront


【解决方案1】:

您好,cloudfront 将 gzip 压缩的文件大小为 1000 字节。所以我的一些 .css 文件低于该文件,因此 gzip 没有发生。现在可以通过云端进行 Gzip 压缩。

【讨论】:

    猜你喜欢
    • 2014-03-23
    • 2018-04-19
    • 2016-10-23
    • 2018-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-12
    相关资源
    最近更新 更多