Tomcat – gzip on httpd or on Tomcat


In a Java web application running in an Apache Tomcat servlet container with an Apache httpd in front of it:

  • is it better to use enable GZIP compression on Tomcat or on httpd level?
  • is it better to have SSL enabled in Tomcat or on httpd?

Application is used in a more or less reliable network (better than public internet, but a little bit worse than LAN) in terms of dropped packets, ping latency etc. The application makes heavy use of large dHTML, AJAX, static and dynamic content. Long user sessions (hours).

Best Answer

Keep both of it at the edge i.e. the server that is connected to the client browser. Compressing the stream is simple enough that it should not tax Apache much and SSL should be used to secure the traffic between Apache and browser.

           (internet)           (local)

You don't want to put the SSL at tomcat while proxying directly over Apache because it will waste needless traffic for the SSL negotiation. Ajp is also somewhat compressed (in a manner of speaking).

Related Topic