Hello all,
I've been trying to set up nginx so that if a user has a cookie 'DEV' they are redirected to one group of servers, however if they do *not* have this cookie set they visit another group of servers, I have tried a few things but cannot get it working, here is my current code:
Code:
upstream developers {
server 10.211.55.1;
server 10.211.55.2;
}
upstream production {
server 10.211.55.9 max_fails=3 fail_timeout=10s;
server 10.211.55.10 max_fails=3 fail_timeout=10s;
server 10.211.55.11 backup;
}
server {
listen 80 default_server;
root /usr/share/nginx/html;
location / {
if ($http_cookie ~* 'DEV') {
proxy_pass http://developers;
break;
}
proxy_pass http://production;
}
}
I am always redirected to developers server