upstream server:port variable ?

Mansoor Peerbhoy mansoor at
Tue Feb 26 15:22:03 MSK 2008


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 

      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 ?

Mansoor Peerbhoy

More information about the nginx mailing list