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.
Status OK Code 200 Encoded 218.89 KB Decoded 218.89 KB Transfered 219.22 KB Compressed No
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.
Edit: As per Tim's answer, I was misled by the Safari reporting numbers. See stackoverflow.com/a/21943693/3944823.
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.