Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat Compression Does Not Add a Content-Encoding: gzip in the Header

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" />

In the HTTP header (as observed via YSlow), however, I am not seeing

Content-Encoding: gzip

resulting in a poor YSlow score.

All I see is

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

I am running an apache mod_jk Tomcat configuration.

How do I compress HTML content with Tomcat, and also have it add "Content-Encoding: gzip" in the header?

like image 336
Julien Chastang Avatar asked Feb 15 '09 00:02

Julien Chastang


Video Answer


1 Answers

Have a look at http://sourceforge.net/projects/pjl-comp-filter/.

Other custom solutions may have memory leaks.

Also, if you are using mod_jk then you are certainly not using the 8080 connector (which supports compression) for those requests.

like image 190
cherouvim Avatar answered Oct 20 '22 00:10

cherouvim