问题原文
原帖链接 · Clayton Lovatto · CC BY-SA 3.0
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 stackoverflow.com/a/21943693/3944823.
已采纳解答
原帖链接 · Tim · CC BY-SA 3.0
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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
