| From | Sent On | Attachments |
|---|---|---|
| saltyflorida | Jan 28, 2010 3:42 pm | |
| Marcus Clyne | Jan 28, 2010 4:03 pm | |
| merlin corey | Jan 28, 2010 4:23 pm | |
| merlin corey | Jan 28, 2010 4:25 pm | |
| Marcus Clyne | Jan 28, 2010 4:48 pm | |
| saltyflorida | Jan 28, 2010 5:50 pm | |
| saltyflorida | Jan 28, 2010 6:00 pm | |
| Piotr Sikora | Jan 28, 2010 6:06 pm | |
| Piotr Sikora | Jan 28, 2010 6:14 pm | |
| saltyflorida | Jan 28, 2010 6:18 pm | |
| saltyflorida | Jan 28, 2010 6:19 pm | |
| Marcus Clyne | Jan 28, 2010 6:49 pm | |
| saltyflorida | Jan 28, 2010 11:04 pm | |
| saltyflorida | Jan 28, 2010 11:13 pm | |
| Marcus Clyne | Jan 29, 2010 2:54 am | |
| merlin corey | Jan 29, 2010 9:38 am | |
| Laurence Rowe | Jan 29, 2010 11:19 am | |
| Marcus Clyne | Jan 29, 2010 3:01 pm | |
| Laurence Rowe | Jan 30, 2010 10:46 am | |
| Marcus Clyne | Jan 30, 2010 4:00 pm | |
| saltyflorida | Feb 2, 2010 9:30 pm |
| Subject: | Re: Switching backends based on a cookie | |
|---|---|---|
| From: | Laurence Rowe (l...@lrowe.co.uk) | |
| Date: | Jan 29, 2010 11:19:30 am | |
| List: | ru.sysoev.nginx | |
I would take a look at HAProxy which has better support for this use case, allowing for requests to be retried against another server if their associated backend is down.
Laurence
2010/1/29 Marcus Clyne <ngx....@gmail.com>:
Hi,
saltyflorida wrote:
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?
Take a look at the map module :
http://wiki.nginx.org/NginxHttpMapModule
One possibility would be :
http {
map $cookie_env $backend {
testing http://backend_testing; staging http://backend_staging; production http://backend_production; }
server { ... proxy_pass $backend;
}
}
Marcus.
_______________________________________________ nginx mailing list ngi...@nginx.org http://nginx.org/mailman/listinfo/nginx
_______________________________________________ nginx mailing list ngi...@nginx.org http://nginx.org/mailman/listinfo/nginx





