| From | Sent On | Attachments |
|---|---|---|
| Avleen Vig | Aug 7, 2009 8:13 pm | |
| miradev | Aug 12, 2009 5:49 am | |
| Johan Bergström | Aug 12, 2009 6:08 am | |
| Valery Kholodkov | Aug 12, 2009 7:01 am | |
| Avleen Vig | Aug 14, 2009 2:33 am | |
| Marcus Clyne | Aug 14, 2009 5:42 am | |
| Johan Bergström | Aug 14, 2009 6:19 am | |
| Valery Kholodkov | Aug 14, 2009 8:22 am | |
| Valery Kholodkov | Aug 14, 2009 8:27 am |
| Subject: | Re: Using memcache to set variables | |
|---|---|---|
| From: | Valery Kholodkov (vale...@grid.net.ru) | |
| Date: | Aug 12, 2009 7:01:28 am | |
| List: | ru.sysoev.nginx | |
----- "Avleen Vig" <avl...@gmail.com> wrote:
I started using the geo module to direct users by IP address, this week, and really like it!
It got me thinking about another thing I've been wanting to do: Direct users to different machines based on some arbitrary data. I don't want to rely just on cookies, because those can be manipulated. Here's what I was thinking, and I'm wondering if it can be done some how in nginx?
You might take a look at the eval module I've recently written:
http://www.grid.net.ru/nginx/eval.en.html
The configuration in your case might look like:
location /a { eval_escalate on;
eval $backend { set $memcached_key $cookie_sessionid; memcached_pass http://memcached_host:port; }
proxy_pass http://$backend; }
This makes sense only if the service which you use to locate machine for a
cookie cannot generate X-Accel-Redirect header. If it can, it's faster and more
transparent to use X-Accel-Redirect.
The sessionid is stored in a cookie. This can't be manipulated or the users ends up not being logged in. Store the sessionid in memcache, and have the value set to the name of a location. Have nginx fetch the value for 'sessionid' from memcache, and then redirect the user internally to that location.
Is this even remotely possible? I think some hardware load balancers can do it, but I'm too poor to buy one of those :-)
-- Regards, Valery Kholodkov





