[Mod_gzip] mod_gzip + mod_ssl + tomcat problem

Viktor Rosenfeld mod_gzip@lists.over.net
Mon, 22 Mar 2004 17:31:05 +0100


Hi,

I've installed mod_gzip together with mod_ssl as outlined in the mini
howto found here:
http://lists.over.net/pipermail/mod_gzip/2002-February/005811.html

It works, with one caveat: We have a tomcat server providing content for
the non-ssl virtual host, ie we have:

<VirtualHost 10.0.0.2:80>
	mod_gzip_on Yes
	DocumentRoot "/opt/tomcat/webapps/ROOT"
	...
</VirtualHost>

<VirtualHost 10.0.0.1:443>
	mod_gzip_on No
	ProxyPass / http://10.0.0.2:80/
	ProxyPassReverse / http://10.0.0.2:80/
	SSLEnable
	...
</VirtualHost>

While this generally works, there is the problem, that the tomcat server
doesn't know, that he is proxyed over a secure socket.  We use
javax.servlet.http.HttpServletResponse.sendRedirect(encodeRedirectURL()) in some
places in our code and this sends a non-ssl URL back to the client.
See:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/servletapi/index.html

While this could be solved programmatically (ie, s/^http:/https:/ before
sending the redirect) it would be much cleaner if this problem could be
solved by configuring tomcat and/or apache to handle this case properly.

I searched google, but didn't anything that was relevant to my problem
at hand.

Any ideas?

Thanks,
Viktor