Tomcat/https: I can see compression is enabled, but file sizes are the same as without compression

by Clayton   Last Updated December 07, 2017 10:00 AM

I have enabled compression on Tomcat running on my machine. The https response header is showing compression is enabled, but the same amount of data is being transferred with and without compression turned on.

Without compression:

Status OK
Code    200
Encoded 218.89 KB
Decoded 218.89 KB
Transfered  219.22 KB
Compressed  No

With compression:

Status  OK
Code    200
Encoded 218.89 KB
Decoded 218.89 KB
Transfered  219.26 KB
Compressed  Yes
Compression 1.00×

I can see Content-Encoding as gzip in response header.

My connector definition in server.xml follows:

<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS"
           keystoreFile="xxxxx" keystorePass="xxxx"
           useSendfile="false" compression="force" />

I am using Tomcat 8.0.12. Browsers are latest versions of Safari running on MAC OS X Yosemite.

Detailed info with compression ON

Detailed info with compression OFF

Edit: As per Tim's answer, I was misled by the Safari reporting numbers. See

Answers 1

Are you sure that it's Tomcat that's not working? It could be that the web browser is incorrectly reporting content size rather than transfer size. Check it with another web browser, or check the web server access logs.

Note - confirmed as per comments above.

March 03, 2016 18:10 PM

Related Questions

IIS 8 Static Compression

Updated April 03, 2017 01:00 AM

Faster zlib alternatives

Updated September 10, 2017 19:00 PM

Disable brotli compression for single nginx vhost

Updated October 10, 2017 08:00 AM

How can I enable GZIP compression in Jetty?

Updated October 18, 2017 01:00 AM