Forum: NGINX Proper way to get uri of backend server

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Chavelle V. (Guest)
on 2009-03-09 15:59
(Received via mailing list)
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
This topic is locked and can not be replied to.