upstream server:port variable ?

Igor Sysoev is at rambler-co.ru
Tue Feb 26 22:16:01 MSK 2008


On Tue, Feb 26, 2008 at 04:22:03AM -0800, Mansoor Peerbhoy wrote:

> A quick question:
> Does nginx have a variable which will give me the actual upstream server:port for the selected upstream server ?
> 
> For instance, if I have:
> 
>     upstream xxx
>     {
>         server  s1:7070;
>         server  s2:7070;
>         server  s3:7070;
>         server  s4:7070;
>     }
> 
> and if I have 
> 
>     server
>     {
>       ...
>       location / 
>       {
>         proxy_pass http://xxx;
>         proxy_set_header    Host    $variable_name; # <-- which variable should I use here, to get "s1:7070" or "s2:7070", etc. ?
>       }
>       ...
>     }
> 
> $server_name  gives me the FQDN of the proxy server,
> $proxy_host   gives me the name of the upstream block (in this case, "xxx")
> 
> Which variable should I use in order to get the precise name of the selected upstream server ?

No, there is no such variable: it's expected that upstreams are equal.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list