Apache redirect response header | DenRaf's Blog
All admins of advanced Apache setups will cross this problem someday. So did I :)
You have some nice reverse proxy setup, everything working just fine, except that one redirect that happens on one of the backend machines to a non default port.
You have no choice then redirect that to a default port. I searched long after this, and with me a collegue
Lets say when you surf to http://myhost.mydomain.com, you are proxied to backend server with ip 193.155.88.23. End for example that backend server redirects you to a non-default port like 8443. And you end up with your browser going to 193.155.88.23:8443 directly. If these ports aren't blocked already, you'll probably go to somewhere completely different.
Normal redirects are catched by your proxy and you'll not see a thing, but not these.
Everybody knows the mod_rewrite module, but that only handles request headers. For this you need to change to response headers. You could do this with some fancy stuff with something self written for using mod_perl or so, but the solution is by far more simplier.
mod_headers is the answer to this problem:
In your VirtualHost config for that machine on your proxy:
Header edit Location ^https://193.155.88.23:8443 https://myhost.mydomain.com
Read full article from Apache redirect response header | DenRaf's Blog
No comments:
Post a Comment