Sticky Session with an assignable backend
Oddur Snær Magnússon
oddur at ccpgames.com
Wed Oct 24 19:50:44 CEST 2012
Unfortunately its 'a REST APi which does not support cookies.
I'm attempting to get it working as a proof of concept using this vmod https://github.com/v arnish/libvmod-var
I might extend it to support a hashtable for efficient lookups.
From: Lasse Karstensen [mailto:lasse.karstensen at gmail.com]
Sent: Tuesday, October 23, 2012 11:19 AM
To: Oddur Snær Magnússon
Cc: varnish-misc at varnish-cache.org
Subject: Re: Sticky Session with an assignable backend
Oddur Snær Magnússon:
> I have a problem where I need to be able to do "sticky session" based on some identity, but be able to tell varnish which identity belongs to which backend.
> In my case, I have a value in the request header(oauth token) which should always go to the same backend. I begin by sending the request to a random backend, and if the users session does not live on that backend I get X-Accel-Redirect header back telling me which backend that request should go to. I can easily do that part using a restart and send the request to the correct one.
> But from then on I want to remember that that specific identity should always go to that given backend.
Given that the HTTP client supports it, I'd just put the backend information into a client side cookie.
Send a set-cookie in deliver, and extract/remove it in recv on the next request.
Varnish Software AS
More information about the varnish-misc