atom feed21 messages in ru.sysoev.nginxSwitching backends based on a cookie
FromSent OnAttachments
saltyfloridaJan 28, 2010 3:42 pm 
Marcus ClyneJan 28, 2010 4:03 pm 
merlin coreyJan 28, 2010 4:23 pm 
merlin coreyJan 28, 2010 4:25 pm 
Marcus ClyneJan 28, 2010 4:48 pm 
saltyfloridaJan 28, 2010 5:50 pm 
saltyfloridaJan 28, 2010 6:00 pm 
Piotr SikoraJan 28, 2010 6:06 pm 
Piotr SikoraJan 28, 2010 6:14 pm 
saltyfloridaJan 28, 2010 6:18 pm 
saltyfloridaJan 28, 2010 6:19 pm 
Marcus ClyneJan 28, 2010 6:49 pm 
saltyfloridaJan 28, 2010 11:04 pm 
saltyfloridaJan 28, 2010 11:13 pm 
Marcus ClyneJan 29, 2010 2:54 am 
merlin coreyJan 29, 2010 9:38 am 
Laurence RoweJan 29, 2010 11:19 am 
Marcus ClyneJan 29, 2010 3:01 pm 
Laurence RoweJan 30, 2010 10:46 am 
Marcus ClyneJan 30, 2010 4:00 pm 
saltyfloridaFeb 2, 2010 9:30 pm 
Subject:Switching backends based on a cookie
From:saltyflorida (ngin@nginx.us)
Date:Jan 28, 2010 3:42:47 pm
List:ru.sysoev.nginx

Is it possible to switch backend clusters of servers based on a cookie?

I would like to set a cookie named "env" and do something like this:

if ($http_cookie ~* "env=testing(;|$)") { proxy_pass http://backend_testing; } if ($http_cookie ~* "env=staging(;|$)") { proxy_pass http://backend_staging; } if ($http_cookie ~* "env=production(;|$)") { proxy_pass http://backend_production; }

However the "proxy_pass" directive is not allowed inside an "if". Is there
another way I can approach this?

Thanks, Eliot

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,46979,46979#msg-46979