Persistence + Round robin

Grzegorz Nosek grzegorz.nosek at
Thu Sep 25 12:16:04 MSD 2008

On Thu, Sep 25, 2008 at 03:56:36PM +0800, Jeffrey 'jf' Lim wrote:
> uh... right - that's the magical "something" there... ;)


How about embedding the upstream ID in the URL or query string and
matching that using the rewrite module? Or as a part of cookies sent to
the client (you could match that via $http_cookie, altough I seem to
remeber that there was a special module for that). So a backend sets a
cookie containing e.g. "backend=1" (along with any other data).

I think you could match it like this:

location / {
	if ($http_cookie ~ backend=1$) {
		proxy_pass http://up_1;
	# etc.

Unfortunately you have to pass something to the client but a cookie will
probably be the least ugly.

Best regards,
 Grzegorz Nosek

More information about the nginx mailing list