Remove only selected cookies from requests?

Espen Braastad espen at
Tue Oct 7 15:49:46 CEST 2008


The question:
Is it possible to match cookie names in each request to a regexp, and 
remove only specified cookies? Other cookies must not be removed.

The scenario:
 - All requests to the site from the clients have cookies from Google 
Analytics set. We would like to remove these.
 - Some of the requests to the site from the clients have cookies with 
session information set. We would like to keep these.

Requests with the Google Analytics cookies set (the cookie names are 
__utmz, __utma, __utmb, __utmc) should get these cookies removed, and 
inserted into cache if no other cookies are present. The requests with 
the session cookies must be passed (default varnish behaviour).

Today we are using unset req.http.cookie on some file types defined in 
the vcl, but a more efficient method would be to remove all the google 
cookies making varnish able to cache even more of the requests.


Espen Braastad,
+47 21 54 41 37
espen at
Linpro AS - Ledende på Linux

More information about the varnish-misc mailing list