Enable GZIP Compression In Tomcat

How to enable GZIP in my tomcat server?


most of people ,they go production ,put tomcat behind apache or nignix as a cluster,

but this could certainly be useful if you are running tomcat standalone.


Here is how to enable GZIP compression on tomcat, edit the file   /conf/server.xml  and append the following cofiguration to connection tag,

 compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" 

 compressableMimeType="text/html,text/xml,text/css,text/plain"/>

the whole configuration like this 


Here is a figure to show the difference whether enables GZIP

Enable GZIP Compression In Tomcat_第1张图片







你可能感兴趣的:(Enable GZIP Compression In Tomcat)