分类: 系统运维
2009-03-04 09:14:37
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 , 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 ^
This will have as a result that the location header send by your backend server will be changed to if it starts with . Your browser directly go to and problem is solved.