2

I want to enable gzip compression on tomcat6 for files larger than 2048 bytes. I therefore set the Connector:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
compression="on"
compressionMinSize="2048"
compressableMimeType="text/html,text/xml,text/css,application/javascript,application/json" />

However, the compressionMinSize parameter does not seem to work. In the Response Header I always get: Content-Encoding:gzip even for small responses (e.g. request size 376B, content size 213B)

Am I missing something?

1 Answer 1

3

The compressionMinSize option is only present in Tomcat 7.0 and up. For Tomcat 6.0 you should use compression="2048" to achieve the same effect.

2
  • 2
    According to the documentation you're right and I've fixed attribute name, but after restarting the server nothing changed. Small responses are still compressed. Sep 26, 2013 at 11:39
  • Tomcat does have some minor yet annoying bugs, which are fixed at later versions. So, if you can, upgrade to the latest version first. Also, try to also use compressionMinSize="2048" which is actually handled in the code but not shown in the documentation. Having said that, my configurations (Tomcat 6 and Tomcat 7) both work properly with the recommended settings, so there may be something special about your setup (valves, filters etc)...
    – tazmanos
    Sep 26, 2013 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.