Enable force-refresh from clients
When receiving a "force-refresh" request from a client, this configuration will fetch the requested element from the backend, update the cache and deliver it to the client.
For large caches, honouring no-cache requests from the client is best handled by setting obj.ttl = 0s in vcl_hit and restarting the request. This is preferable to calling purge_url in your VCL because it avoids building up a large purge list and potentially exhausting memory resources.
See this discussion on the mailing list for details.
sub vcl_hit {
if (!obj.cacheable) {
pass;
}
if (req.http.Cache-Control ~ "no-cache") {
# Ignore requests via proxy caches, IE users and badly behaved crawlers
# like msnbot that send no-cache with every request.
if (! (req.http.Via || req.http.User-Agent ~ "bot|MSIE")) {
set obj.ttl = 0s;
return (restart);
}
}
deliver;
}
