Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Tomcat 7 GZIP compression not working

I have added the following lines in tomcat's conf/server.xml file to enable gzip compression but its not working. Pages are still uncompressesd.

 <Connector port="8080"          compression="on"          compressionMinSize="2048"          noCompressionUserAgents="gozilla, traviata"          compressableMimeType="text/html,text/xml,text/plain,text/css,          text/javascript,text/json,application/x-javascript,          application/javascript,application/json"/> 

Any idea?

like image 786
N.. Avatar asked May 20 '13 16:05


People also ask

How do I enable gzip compression on Tomcat?

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" Code language: HTML, XML (xml)

Which servers support gzip compression?

Servers like Apache, Tomcat, JBoss etc supports gzip compression too. Hence if gzip is enabled in such servers, the response if first compressed and then send to client.

What is a gzip file format?

Gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix. Want to master Tomcat Server ? Subscribe to our newsletter and download the Apache Tomcat Cookbook right now!

Is it possible to use Apache compression with Tomcat?

this could certainly be useful if you are running Tomcat standalone, and using apache compression is simply unavailable. anyways gud job. Thanks Aditiya for the comment… Definitely Apache server can be used that can do this..

1 Answers

If Tomcat is fronted by Apache on port 80, you will need to enable compression in Apache itself. The compression in Tomcat will only work if you access it directly on port 8080.

like image 76
David Levesque Avatar answered Sep 18 '22 15:09

David Levesque