'$pool' variable will be created just after the request come. This is how the 'map' works. To make this work you will have to use this variable in "proxy_pass". ======= server { ..... proxy_pass http://$pool; } ======= Posted at Nginx Forum: https://forum.nginx.org/read.php?2,293738,293739#msg-293739