Hi,<div><br></div><div>I am trying to put varnish cache server infront of my apache server to accelerate the performance. </div><div><br></div><div>I want to cache the data based on few cookies </div><div><br></div><div>I have tested with single cookie and it does work </div>
<div><br></div><div>but I have an use case where i need to cache the data based on combination of cookies </div><div><br></div><div><br></div><div>use case </div><div><br></div><div><div>if( req.http.Cookie ~ "Cookie1" && (! req.http.Cookie ~ "Cookie2")) {</div>
<div> set req.http.X-Varnish-Hashed-On =</div><div> regsub( req.http.Cookie, "Cookie1=([^;]*);*.*$", "\1" );</div><div> }</div><div><div>if( req.http.Cookie ~ "Cookie1" && req.http.Cookie ~ "Cookie2") {</div>
<div> set req.http.X-Varnish-Hashed-On =</div><div> regsub( req.http.Cookie, "Cookie1=([^;]*);*.*$", "\1" )+regsub( req.http.Cookie, "Cookie2=([^;]*);*.*$", "\1" );</div>
<div> }</div></div><div><br></div><div>hash_data(req.http.X-Varnish-Hashed-On);</div><div>return(hash);</div><div><br></div><div>On the compilation phase it works fine </div><div><br></div><div>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.</div>
<div><br></div><div>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. </div><div><br></div>-- <br>Nitin Pawar<br><br>
</div>