rewriting a redirect

Per Jonsson poj+nginx at lysator.liu.se
Thu Mar 1 16:17:25 MSK 2007


On Thu, Mar 01, 2007 at 01:51:52PM +0100, Jure Pe??ar wrote:
> 
> Hello all,
> 
> I run nginx on port 80 in front of apache with mod_backhand on port 81 on the same machine, which does the load balancing across backend apache servers.
> 
> Our application makes a redirect on a few rarely visited places and there apache generates a redirect in the form of http://domain:81/place/to/go. Thats get fed to the client, which sees a "connection refused" because of the closed 81 port.
> 
> What is the right way to fix this?

You need to add a line telling nginx to rewrite the headers that come back from the backend. 
Eg. something like this:

proxy_redirect http://domain:81/ /;
proxy_pass  http://domain:81;

The proxy_redirect is the part you need in your config.

Good luck!

Per





More information about the nginx mailing list