Tomcat压缩不会在标头中添加内容编码:gzip [英] Tomcat Compression Does Not Add a Content-Encoding: gzip in the Header
问题描述
我正在使用Tomcat压缩我的HTML内容,如下所示:
I am using Tomcat to compress my HTML content like this:
<Connector port="8080" maxHttpHeaderSize="8192"
maxProcessors="150" maxThreads="150" minSpareThreads="25"
maxSpareThreads="75" enableLookups="false" redirectPort="8443"
acceptCount="150" connectionTimeout="20000" disableUploadTimeout="true"
compression="on" compressionMinSize="128" noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html"
URIEncoding="UTF-8" />
然而,在HTTP标题中(通过YSlow观察),我没有看到
In the HTTP header (as observed via YSlow), however, I am not seeing
Content-Encoding: gzip
导致YSlow评分较差。
resulting in a poor YSlow score.
所有我看到的是
HeadersPost
Response Headers
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=ISO-8859-1
Content-Language: en-US
Content-Length: 5251
Date: Sat, 14 Feb 2009 23:33:51 GMT
我正在运行apache mod_jk Tomcat配置。
I am running an apache mod_jk Tomcat configuration.
如何使用Tomcat压缩HTML内容,并在标题中添加Content-Encoding:gzip?
How do I compress HTML content with Tomcat, and also have it add "Content-Encoding: gzip" in the header?
推荐答案
看看 http://sourceforge.net/projects/pjl-comp-filter/ 。
其他自定义解决方案可能有内存泄漏。
Other custom solutions may have memory leaks.
另外,如果你是使用mod_jk然后你肯定没有使用8080连接器(它支持压缩)这些请求。
Also, if you are using mod_jk then you are certainly not using the 8080 connector (which supports compression) for those requests.
这篇关于Tomcat压缩不会在标头中添加内容编码:gzip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!