Varnish Cached Object Time

How can we get the the time of the cached object in varnish.

My requirement is something like, say if object is in cache for 5 mins and for a specified ip, I want to server the content from backend but not from cache.

Upvotes: 1

Views: 97

Answers (1)

Brian van Rooijen
Brian van Rooijen

Reputation: 2016

You can setup your vcl so it will always miss when certain headers are set or when the request comes from a certain browser

in your vcl_recv set

sub vcl_recv {
if (req.http.Cache-Control ~ "no-cache" && client.ip ~ editors) {
     set req.hash_always_miss = true;
}

}

https://www.varnish-cache.org/trac/wiki/VCLExampleEnableForceRefresh

Upvotes: 1

Related Questions