I want to use cookie to indicate which backend server to perform the request. here is my configuration:
upstream backend_prod {
server 127.0.0.1:8080;
}
upstream backend_abenv {
server 127.0.0.1:9090;
}
map $COOKIE_backend $gated {
default prod;
eexxpptt abenv;
}
server {
listen 8888;
server_name localhost;
location / {
index index.jsp index.html index.htm;
proxy_pass http://backend_$gated;
}
}
I have set cookie backend:eexxpptt.
But I got a weird URL http://backend_prod
when I visit http://localhost:8888
in chrome. And do not reach the 8080 or 9090 server.
Any advice?