How to enable GZIP in my tomcat server?
Here is how to enable GZIP compression on Tomcat: edit file /conf/server.xml
and add to the HTTP Connector configuration something like this:
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
An example of a HTTP Connector configuration with compression enabled could be:
<
Connector
port
=
"8080"
maxHttpHeaderSize
=
"8192"
maxThreads
=
"150"
minSpareThreads
=
"25"
maxSpareThreads
=
"75"
enableLookups
=
"false"
redirectPort
=
"8443"
acceptCount
=
"100"
connectionTimeout
=
"20000"
disableUploadTimeout
=
"true"
compression
=
"on"
compressionMinSize
=
"2048"
noCompressionUserAgents
=
"gozilla, traviata"
compressableMimeType
=
"text/html,text/xml"
/>