Using memcache to set variables

Avleen Vig avleen at
Sat Aug 8 07:13:51 MSD 2009

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?

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 :-)

More information about the nginx mailing list