Help with setting proxy_header
Francis Daly
francis at daoine.org
Sat Mar 24 19:58:15 UTC 2012
On Sat, Mar 24, 2012 at 12:40:06AM +0000, Micheal Wolfskill wrote:
Hi there,
> if ($host = '23.71.33.142' ) { proxy_set_header Host www.domain.com; }
> location / { proxy_pass http://31.186.1.131:60/; }
You want to have
proxy_set_header Host $host;
unless $host is this IP address, in which case you want a different value?
set $myhost $host;
if ($host = '23.71.33.142') { set $myhost www.domain.com; }
proxy_set_header Host $myhost;
where the first two are at server{} level, and the last is at server{}
or location{} level.
Using the "map" directive is another way of setting your $myhost variable.
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list