Cookies - set on non-cached pages, read on all pages

Richard Chiswell richard.chiswell at mangahigh.com
Tue Apr 20 17:13:00 CEST 2010


Hi David,

On 20/04/2010 16:08, David Murphy wrote:
> Thanks Rich
>
> When you say ignore  do you mean unset e.g.
>
> sub vcl_recv {
>     //snip
>    unset req.http.cookie;
> }
>    
We do something like:
sub vcl_recv {
...
if (req.http.Cookie) {
      set req.http.Cookie = ";" req.http.Cookie;
      set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
      set req.http.Cookie = regsuball(req.http.Cookie, 
";(Cookies|WeWantTo|Keep)=", "; \1=");
      set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
      set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");
    if (req.http.Cookie == "") {
         remove req.http.Cookie;
     }
}
...
}

The Cookies|We... regular expression are for things like admin cookies 
which we want to be set.

Rich




More information about the varnish-misc mailing list