To configure gzip compression with tomcat you need the following:
- Solution is to enable compression to Tomcat as well. /opt/tomcatX/conf/server.xml needs to be modified and
- <Connector port="8080" protocol="HTTP/1.1"connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>
- has to be replaced with
- <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