Gzip proxied

来自linux中国网wiki
跳到导航 跳到搜索

gzip for cdn

问题出现了 

Serving Compressed Files When Your Origin Server Is Running NGINX

When CloudFront forwards a request to the origin server, it includes a Via header. This causes NGINX to interpret the request as proxied and, by default, NGINX disables compression for proxied requests. If your version of NGINX includes the gzip_proxied setting, change the value to any so that NGINX will return compressed content to CloudFront. For more information, see the NGINX documentation for the module ngx_http_gzip_module.

可见 添加 如下到 nginx 字段
gzip_proxied    expired

Nginx作为反向代理的时候启用,开启或者关闭后端服务器返回的结果,匹配的前提是后端服务器必须要返回包含"Via"的 header头。

参考

http://nginx.org/en/docs/http/ngx_http_gzip_module.html 详细解释:nginx中gzip的各项配置以及配置参数的意思详解 http://blog.csdn.net/jessonlv/article/details/8016284 http://docs.aws.amazon.com/zh_cn/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-file-types