hashing based on cookie combinations
Nitin Pawar
nitinpawar432 at gmail.com
Tue May 8 08:59:54 CEST 2012
Hi,
I am trying to put varnish cache server infront of my apache server to
accelerate the performance.
I want to cache the data based on few cookies
I have tested with single cookie and it does work
but I have an use case where i need to cache the data based on combination
of cookies
use case
if( req.http.Cookie ~ "Cookie1" && (! req.http.Cookie ~ "Cookie2")) {
set req.http.X-Varnish-Hashed-On =
regsub( req.http.Cookie, "Cookie1=([^;]*);*.*$", "\1" );
}
if( req.http.Cookie ~ "Cookie1" && req.http.Cookie ~ "Cookie2") {
set req.http.X-Varnish-Hashed-On =
regsub( req.http.Cookie, "Cookie1=([^;]*);*.*$", "\1" )+regsub(
req.http.Cookie, "Cookie2=([^;]*);*.*$", "\1" );
}
hash_data(req.http.X-Varnish-Hashed-On);
return(hash);
On the compilation phase it works fine
but when I send a web request with these user cases ( first send with
cookie1 and then both cookie1 and cookie2) , it always returns the data
cached with cookie1 and does not respect the cookie2 combination.
Please do let me know if I am doing something wrong. I could not find
anywhere how do put multiple cookies in place for hashing the data.
--
Nitin Pawar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120508/c09b884f/attachment.html>
More information about the varnish-misc
mailing list