0
Google PageSpeed Insights建議我在文件asyncload.php
上使用gzip壓縮。如何在Nginx中爲XHR類型添加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壓縮?