I have finished development of a Java EE web application
Under Eclipse IDE and Tomcat v6.0 as a localhost Server
Now I need to make my localhost Server (Tomcat v6.0) Enable compression "gzip"
For static resources as (JavaScript files, CSS files , Images , ...)
Open /conf/server.xml,
add this configuration in your HTTP connector:
compression="on"
compressionMinSize="2048"
compressableMimeType="application/javascript, text/css"
For example:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
compression="on"
compressionMinSize="2048"
compressableMimeType="application/javascript, text/css"/>
More Apache Tomcat HTTP
If you want to gzip js and css files than Iswanto San's answer is correct.
If you want to gzip html pages then the following configuration should help.
compression="on"
compressionMinSize="2048"
compressableMimeType="text/html,text/xml"
If you want to gzip all response
compressableMimeType="text/html, text/xml,text/plain,text/javascript,text/css"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With