Do I need to unset cookie in vcl_fetch if there is remove req.http.Cookie in vcl_recv?

David Murphy david at firechaser.com
Fri Feb 11 01:48:47 CET 2011


Hello

I've been testing removing cookies from images/css/js and am a little
unclear on the difference between:


//start ==========
 sub vcl_recv {
 if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
       remove req.http.Cookie;
  }
//end==========


and...


//start =========
sub vcl_recv {
 if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
   unset req.http.cookie;
 }
}

sub vcl_fetch {
 if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
   unset beresp.http.set-cookie;
 }
}
//end =========


The first example removes the cookie from
the incoming requests for these files so that these objects are
cacheable.

What I'm a bit unclear on is why the 2nd example uses 'unset' in both
vcl_recv and also when the object has been retrieved from the backend
(vcl_fetch).

I need to be 100% sure that for all image/css objects, there are no
cookies stored anywhere. Is this what the first example does, whereas
the second example 'ignores' the cookie?

Thanks for any help.

Best, David




More information about the varnish-misc mailing list