Use an if in vcl_recv. If you need to stick based on cookie, use that header; I
use X-F-F for a load-balancer setup.
sub vcl_recv {
# set client.identity based on x-f-f header, use that to stick to a backend
server
if (req.http.x-forwarded-for) {
set client.identity = req.http.x-forwarded-for;
set req.backend = tomcat;
}
# more stuff goes here
return(lookup);
}
Stefan Caunter :: Senior Systems Administrator :: TOPS
e: [email protected] :: m: (416) 561-4871
www.thestar.com www.topscms.com
From: [email protected]
[mailto:[email protected]] On Behalf Of Michael Bu
Sent: December-01-10 2:16 PM
To: [email protected]
Subject: client.identity and client director -- How?
Hi All,
I want to know how to setup a client director and make use of client.identity
to force the request always going to the same backend instance (ie. sticky).
Here's my setup:
backend a {
.host = "192.168.1.4";
.port = "8880";
}
backend b {
.host = "192.168.1.5";
.port = "8880";
}
director tomcat client {
{
.backend = a;
.weight = 1;
}
{
.backend = b;
.weight = 1;
}
}
sub vcl_recv {
## set sticky bit for backend director ##
set client.identity = regsub(req.http.Cookie, ".*JSESSIONID=.*\.(\w).*",
"\1");
set req.backend = tomcat;
}
Unfortunately the above setup didn't work as expected.
Could some one please give me some advice?
Thanks in advance!
Michael
_______________________________________________
varnish-misc mailing list
[email protected]
http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc