0
votes

I am new to varnish and just found out, that if a page request contains any cookie, it will not cache it.

Is there an exception for this? I would like to have varnish cache all pages with cookies EXCEPT pages containing the cookie $_SESSION.

Is this possible?

1

1 Answers

0
votes

You could remove the cookies in Varnish if it does not contain the "$_SESSION" cookie. To do this you need to add this (or something similar - I did not test it) to your VCL:

sub vcl_recv {
  if (!req.http.Cookie ~ "\$_SESSION") {
    unset req.http.Cookie      
  }
}