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).


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).


I would enable gzip in Apache. This allows you to compress all content served from there in one go, should you ever decide to add another application or serve some static content as well.

I am not certain about the SSL part, but I would think that should go in Apache as well, since once encrypted compression and any caching you may wish to use would not function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.