enable Gzip compression with tomcat

To configure gzip compression with tomcat you need the following:

  1. Solution is to enable compression to Tomcat as well. /opt/tomcatX/conf/server.xml needs to be modified and
  2. <Connector port="8080" protocol="HTTP/1.1"connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>
  3. has to be replaced with
  4. <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"compressionMinSize="2048"noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml,image/jpeg,text/css,text/javascript"/>



While the not forwarded, served by Apache content is compressed, the content served from communication with Tomcat is not.
Check our other tutorial on how to enable gzip in nginx https://gss-portal.com/knowledgebase/89/Gzip-compression-enable-on-nginx.html

 

  • GZIP, tomcat, compression
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

 Catalina cache warnings: Unable to add the resource to the cache

IssueApache Tomcat logs, e.g. logs/catalina.out continuously report: Unable to add the resource...

 How to find the correct Java Heap Settings for your Server

By default Tomcat is configured to use a minimum of 64 MB of RAM and a maximum of 128 MB of RAM...

 Tomcat Native library which allows optimal performance in production environments was not found

In the default tomcat deployment, you may see this error in regard to missing tomcat native...

 Tomcat SSL without keystore

Starting from tomcat8 we can configure the tomcat SSL protocol without the need of a keystore.It...

 Importing an SSL certificate into the keystore

In this short tutorial we will present how to import a pem certificate into a pfx and then into a...