I have a tomcat container which is sitting behind an Apache 2.2 mod_proxy server. At the moment, the tomcat container, when doing a redirect is redirecting to an absolute URL every time using a code 302. The URL is unfortunately wrong (localhost:port format) which means the moment it does a redirect, the web app no longer works. I cannot change the tomcat container config as it's out of my control (vendor supplied).
I am using ProxyPassReverse but this ignores absolute URLs specified in 302 redirects.
Is there a way to persuade apache to rewrite an absolute URL to a relative URL during a proxy fetch?
My (relevant config) is:
ProxyPass /teamcity http://localhost:8111/teamcity
ProxyPassReverse /teamcity http://localhost:8111/teamcity
ProxyPreserveHost On
I'm not using AJP and as I've said before I cannot change the container config so this needs to be a 100% apache config solution.
I will accept the first answer that works instantly!
Header setdoesn't have the flexibility to make that kind of dynamic change - it can plop a new header in, replacing the current one, but can't do a regex modification of the header that's in place. – Shane Madden Dec 8 '11 at 19:07