Is it possible to support use of variable to point to an upstream while using fastcgi_pass?
Currently, something like following does not work and throws "no port in upstream" error. Replacing the variable with the name of upstream directly works as expected.
upstream xyz_backend {
server 192.168.56.102:9000;
server 192.168.56.103:9000;
}
server{
.....
set $var_backend xyz_backend;
location ~ \.php$ {
root /var/www/sites/xyz;
fastcgi_pass $var_backend;
}
}
My use case for this feature is to dynamically pick the upstream name from a map of cookie value (or host) to upstream names. The cookie value (or host) represents a unique source or type of traffic in this case.
Thanks