4 messages in ru.sysoev.nginxRe: upstream server:port variable ?
FromSent OnAttachments
Mansoor PeerbhoyFeb 26, 2008 4:21 am 
Eden LiFeb 26, 2008 11:06 am 
Igor SysoevFeb 26, 2008 11:15 am 
Igor SysoevFeb 26, 2008 11:17 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: upstream server:port variable ?Actions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Feb 26, 2008 11:15:38 am
List:ru.sysoev.nginx

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.