Proxy behind firewall where ports don't match

Casey Rayman casey.rayman at
Wed Jan 23 04:22:47 MSK 2008

I've got a situation where the port being served to the outside world  
and the proxy port may not be the same.  e.g. firewall:9000 => nginx: 
8080 => realserver:8000

I'm currently using the following line which seems to take care of  
everything but the port:
	proxy_redirect  http://realserver:8000 https://$host:9000;

I'd like something like this:
	proxy_redirect  http://realserver:8000 https://$host:$port;

Where $host:$port turns into firewall:9000 for the above example.   
I've found variables for both the nginx port and the realserver port,  
but can't find anything for the port the client sent the request to.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list