Issue in gzip compression

2019-07-21 14:39发布

问题:

I am using gzip to compress the loading files. For that i have written the following code in server.xml in tomcat.

<Connector 
compressableMimeType="text/html,text/xml,text/json,text/javascript,text/css,text/plain,application/json,application/javascript"
compression="on"
compressionMinSize="2048"
connectionTimeout="200000"
noCompressionUserAgents="gozilla, traviata"
port="8080"
protocol="HTTP/1.1"
redirectPort="8443"/>

What i get is "Content-Encoding : gzip". But for some files it is not get compressed.I cant get where the problem is. Please some one help me to solve this issue.

回答1:

I changed the value of compression to "force".It works.

For reference