Proper way to get uri of backend server

Vincent Chavelle vincent.chavelle at
Mon Mar 9 16:46:28 MSK 2009

Hi everybody,

I want return a page with simply the uri of backend server. For
example, I have two servers (, and
when a client ask to /geturi/?TEST=hello, I want to hash 'hello' for
retrieving a server hostname.

This is my solution :

# on loadbalancer
upstream backend_ap {
        hash   $arg_TEST;

location /geturi {
       default_type  text/html;
       proxy_pass http://backend_ap;

# on backend server
location / {
       root html;
       index /index.html;

       allow   X.X.0.0/16;
       deny    all;

# cat /usr/local/nginx/html/index.html

Do you have a faster way ?

Thanks in advance

Vincent Chavelle

More information about the nginx mailing list