默认情况下,当下载文件的时候会开启gzip和chunk。
但是chunk没有Content-Length,而范围响应 206 Partial Content又需要Content-Length,
这样的话要让apache同时支持gzip和断点续传就麻烦了。
解决方案是:
遇到text/plain类型的就启用gzip(apache同时会自动启用chunk)
遇到二进制类型的就不启用gzip(apache同时也就不会启用chunk了)
配置文件修改:
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
#遇到MIME为text类型的就启用gzip
#遇到其他MIME类型的就不启用gzip
#DeflateFilterNote Input instream
#DeflateFilterNote Output outstream
#DeflateFilterNote Ratio ratio
#LogFormat ‘"%r" %{outstream}n/%{instream}n (%{ratio}n%%)’ deflate
CustomLog logs/deflate_log.log deflate
#开启Accept-Ranges响应头