Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
Fair point! I'd raise it again but I get the feeling I'll get shot. – Chris Smith Dec 8 '11 at 14:03
I've flagged this as such, so hopefully one of the moderators will move it over for you. – ziesemer Dec 8 '11 at 14:04
Cool thanks for this. – Chris Smith Dec 8 '11 at 14:05
Unfortunately, I think the issue here is that Header set doesn'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
That's where I got to. No further unfortunately. – Chris Smith Dec 9 '11 at 10:33

migrated from stackoverflow.com Dec 8 '11 at 15:29

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.