Loading
 
What's Next: View All Tutorial →

How to add gzip in the web application to compress the response size to load page faster in apache tomcat

Open the server.xml file from the conf folder Add the following attribute in the <connector> tag compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" compressableMim...

Published Date: 01/04/2015  Last Modified Date: 01/04/2015    New Post



Open the server.xml file from the conf folder

Add the following attribute in the <connector> tag
compression="on"
  compressionMinSize="2048"
  noCompressionUserAgents="gozilla, traviata"
  compressableMimeType="text/html,text/xml,text/javascript,text/css,application/javascript" 


Final Ouput:
 
 <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
			   compression="on"
  compressionMinSize="2048"
  noCompressionUserAgents="gozilla, traviata"
  compressableMimeType="text/html,text/xml,text/javascript,text/css,application/javascript" />

Restart the tomcat server.

To test it, Open opera browser and hit the web page url, Go to network tab in the developer tool( Press f12 to open).

The size will be different with the normal size and the compressed size.
Awaiting for Administrator approval





Tags: Spring MVC

← Back to list


Related Post




×