proxy_redirect and variables

Tobia Conforto tobia.conforto at gruppo4.it
Mon Mar 29 19:30:19 MSD 2010


Hello

Does anybody know anything about this?


> Hi
> 
> Does anybody know why proxy_redirect won't interpolate variables in its first argument?
> 
> I'm trying to setup a reverse proxy to a backend that uses name-based virtual hosts, so I need to change both the incoming Host header and the outgoing Location headers:
> 
> server {
>    server_name public.hostname.com;
> 
>    set $proxy_to private.hostname.com
> 
>    location / {
>        proxy_pass http://backend;
>        proxy_redirect http://$proxy_to/ http://$host/;
>        proxy_set_header Host $proxy_to;
>    }
> }
> 
> This doesn't work, unless I expand $proxy_to in proxy_redirect by hand.
> 
> Am I supposed to write it in another way?
> 
> I'm using 0.8.32 on Linux amd64.
> 
> Tobia



More information about the nginx mailing list