I'm developing a web application locally on my system, serving it using Tomcat (tomcat-7.0.52). In production, I want to front the Tomcat with an Apache httpd (Apache/2.2.15).
This works and I managed to configure caching as needed. Now I want to configure compression, but it seems that a can't get Apache httpd to modify the response it got from Tomcat.
But as I read here, this is the preferred way of doing to. mod_jk compression is only between httpd and Tomcat and if I want to configure compression directly in Tomcat, I'd need an extra servlet for it.
I have the following line in my vhost-file to enable compression of static and httpd-served content:
#SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/plain text/html application/json text/xml text/css text/javascript
Enabling the 1st line didn't change anything for me.
I pass these requests to Tomcat using mod_jk:
<IfModule mod_jk.c>
JkMount /myapp/j_security_check worker1
JkMount /myapp/*.jsp worker1
JkMount /myapp/DataSourceLoader worker1
JkMount /myapp/ServletLogin worker1
</IfModule>
Using Firebug I can see that the mime-type of the Tomcat-returned requests is
/myapp/j_security_check: "text/plain; charset=UTF-8" (with the space)
/myapp/*.jsp: "text/plain; charset=UTF-8" (with the space)
/myapp/DataSourceLoader: "application/json;charset=UTF-8" (without space)
Because of the spaces I can't add to AddOutputFilterByType and as I also have the mime-types without the UTF-8 and I also tried with just SetOutputFilter, I think that these directives do not manipulate the Tomcat answer at all.
So my questions are:
What's the best suggested solution? Tomcat compression or Apache httpd compression? (According to gzip compression using mod_deflate apache with tomcat (which redirects here: https://stackoverflow.com/questions/16653642/tomcat-7-gzip-compression-not-working) it should be done in httpd)
How do I enable Apache httpd-compression for mod_jk results (perhaps from JBoss and not Tomcat)?
Perhaps related: How do I modify caching headers from mod_jk results in Apache httpd?
Thank you!