【发布时间】:2017-02-20 02:46:38
【问题描述】:
Google PageSpeed Insights 建议我对文件 asyncload.php 使用 gzip 压缩。
查看开发者工具,asyncload.php服务的内容在XHR类型下。
我正在使用 Nginx,这是我当前在 nginx.conf 中支持 gzip 的配置。
gzip on;
gzip_comp_level 9;
gzip_http_version 1.1;
gzip_proxied any;
gzip_min_length 10;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/xhtml+xml;
# Disable for IE < 6 because there are some known problems
gzip_disable “MSIE [1-6].(?!.*SV1)”;
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;
我的问题是:
如何在通过 PHP 脚本提供的 XHR 类型上添加 gzip 压缩?
XHR 是否在所有浏览器上都完全支持 gzip 压缩?
【问题讨论】: