using the max-age request header

Jeroen Ooms jeroen.ooms at stat.ucla.edu
Tue Mar 20 01:11:57 CET 2012


How do I configure my VLC to let Varnish respect the 'Cache-Control
max-age' request header? Someone on SO suggested the following:

if (req.http.Cache-Control ~ '\bmax-age=\b`) {
    if (std.duration(regsub(req.http.Cache-Control,
".*\bmax-age=(\d+)\b.*", "\1s"), 0s) < obj.age) {
        return (pass);
    }
}

However, what I don't like about this is that vcl_pass does not
actually update the cache with the new entry. How can I configure it
so that when max age < obj.age, a fresh copy will be fetched and
inserted into cache?



More information about the varnish-misc mailing list