Search code examples
varnishvarnish-vcl

how to check cookie expiration in Varnish


In my application, when user logged in, we don't want to cache any content. So we bypass user directly to backend. we don't that like following. if (req.http.cookie ~ "(isLoggedIn)") { return (pass);} This work as expected.

Now, issue is if user log off, our server don't delete cookie but put expired cookie. So cookie is still exists but it is expired. But as varnish just looks for cookie, it won't cache page.

Is there any way i can also check cookie expiration date and compare it with current date?


Solution

  • You can't control cookie expiration time on Varnish during client request, because browsers doesn't send cookie parameters (except name=value).