如何判断mod_deflate是否真的有效?

Modified on: Thu, 08 Aug 2019 19:00:02 +0800

我在http.conf文件中添加了以下内容:

# mod_deflate configuration
<IfModule mod_deflate.c>

# Restrict compression to these MIME types
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css

# Level of compression (Highest 9 - Lowest 1)
DeflateCompressionLevel 9

# Netscape 4.x has some problems.
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

</IfModule>

我的内容不会返回gzip类型的Content-Encoding,但是我发现自己得到了更多的304并且Etag附加了一个+ gzip后缀。 mod_deflate实际上是在做它的工作吗? (抱歉n00b-ishness)

作者:Jay

最佳答案

标题告诉你什么,如果它没有返回“content-encoding:gzip”它可能不起作用..你可以测试如下:

curl -I -H 'Accept-Encoding: gzip,deflate' http://yoursite.com/somefile

相关问答

添加新评论