I'm trying to enable gzip compression in my Apache server which is fronting a Tomcat instance using a connector. I tried several variants of the module configuration settings in my httpd.conf. Here is my latest attempt:
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
DeflateCompressionLevel 9
SetEnvIfNoCase Request_URI \.(?:gif|png|jpg|jpeg)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog "/var/output/logs/deflate_log" deflate
ErrorLog "/var/output/logs/deflate_error_log"
I'm checking the response headers using Firebug and I verified that the request headers have Accept-Encoding: gzip deflate
but every time, the Content-Encoding
header is missing from response.
I tried adding the following line to httpd.conf
, but it is giving an error that mod_deflate
is a built-in module and cannot be loaded. I confirmed this by apachectl -t
and it shows mod_deflate.c
as compiled module.
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
I've a Tomcat instance that is connected to Apache via AJP connector. When I debugged my servlets, I found that the response Content-Type
I'm getting for my test script is application/javascript;charset=UTF-8
. I initially was using AddOutputFilterByType
directive and thought that the additional charset=UTF-8
part might be messing up the MIME type for Apache, but then it isn't working with SetOutputFilter DEFLATE
also.
My custom logs for deflate
show the following line repeatedly:
GET /myservlet HTTP/1.1" -/- (-%)
I don't understand why this isn't working. My Apache version is 2.0.63
. Did anybody face similar issue? Is there anyway I can debug further and check what is going on within Apache? Perhaps enabling some debug logging?
Thanks,
Venkat.
No comments:
Post a Comment