Faustus
Faustus

Reputation: 21

Tomcat and GZIP compression does not work

I have looked at all other "answers" before and nothing worked.

I have a simple setup.

Tomcat7, webapp with spring. I am trying to enable the gzip compression but nothing works.

I checked with chrome dev tools and firefox firebug and yslow and curl command line.

this is my config:

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" 
compression="force" 
compressionMinSize="2048" 
noCompressionUserAgents="gozilla, traviata" 
compressableMimeType="text/html,text/xml,text/css,
text/javascript,application/javascript,application/x-javascript,
application/xhtml+xml,application/xml"  />

This is the response header:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Accept-Ranges: bytes
Etag: W/"79106-1390670828000"
Last-Modified: Sat, 25 Jan 2014 17:27:08 GMT
Content-Type: text/css
Vary: Accept-Encoding
Date: Sun, 26 Jan 2014 18:45:25 GMT
Content-Length: 79106

This is the request header:

GET /vb/pages/layout/static/vb-1.11.css HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Accept: text/css,*/*;q=0.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: JSESSIONID=C73CFF565AC51B8C4C26FE3954FD1175
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

I don't have apache turned on, and there are no proxies. A straight request to localhost with port 8080 directly.

P.S: I can't post images yet, i need more reputation points :S.

Am lost.

Thanks!

Upvotes: 2

Views: 1591

Answers (1)

Aaron
Aaron

Reputation: 21

Sometimes when you attempt a test, you try a page that is below the minimum size for compression. Try reducing the compressionMinSize="2048" attribute from "2048" to a low value like "3" or "5".

Upvotes: 2

Related Questions