Welcome! Log In Create A New Profile

Advanced

Re: Help with setting proxy_header

Francis Daly
March 24, 2012 04:00PM
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@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Help with setting proxy_header

Micheal Wolfskill March 23, 2012 08:42PM

Re: Help with setting proxy_header

Francis Daly March 24, 2012 04:00PM

Re: Help with setting proxy_header

Alexander Kolesen March 26, 2012 07:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 274
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready