Handling cookies
David Murphy
David at firechaser.com
Sat Mar 13 10:58:53 CET 2010
Hello
I am trying to configure Varnish to cache everything except a few specific URLs that need to be passed back to Apache/PHP. This is what I have so far
sub vcl_recv {
if (req.request == "POST"
|| req.url ~ "^/my-details"
|| req.url ~ "^/cart"
|| req.url ~ "^/billing-details"
|| req.url ~ "^/delivery"
) {
pass;
}
if (req.request == "GET") {
unset req.http.cookie;
unset req.http.Authorization;
lookup;
}
//default action, just in case
lookup;
}
sub vcl_fetch {
if (req.request == "GET") {
unset obj.http.Set-Cookie;
set obj.ttl = 30m;
}
}
sub vcl_hash {
if (req.http.Cookie) {
set req.hash += req.http.Cookie;
}
What I'm finding are two issues:
1. javascript and css files are not being cached (I am monitoring using varnishtop -b -i TxURL ) even though my vcl_recv would appear to be caching everything that is pulled via GET
2. The non-cached pages ( e.g. /my-details accessed via GET) do not seem to pick up all of the cookies generated in PHP, yet if I call the same page via Apache directly ( by passing Varnish) the cookies are found fine.
If someone could point me in the right direction that'd be much appreciated.
Thanks, David
More information about the varnish-misc
mailing list