Problems with Cache-Control: max-age=0

Mike Adolphs mike at
Sun Jul 11 12:12:00 CEST 2010


I've just been playing around with Varnish since yesterday, read the
various examples and thought I'll give it a try with caching munin
generated png's for 3600s (just as a test). When I now refresh the
page I see that the cache is missed. Couple of seconds and a refresh
later I see that the cache gets hit.
So far so good, but a few minutes later new requests hit the backend
again instead of getting its content from the cache. How do I alter
the incoming request's header to unset or alter the Cache-Control:
max-age=0? Is that possible?

My current config looks like the following, but this is obviously for
backends that sends "Cache-Control: no-cache, no-store, max-age=0,

sub vcl_recv {
  if (req.request == "GET" && req.url ~ "\.(html|jpg|jpeg|gif|ico|png)$") {

sub vcl_fetch {
  if (req.request == "GET" && req.url ~ "\.(html|jpg|jpeg|gif|ico|png)$") {
    set obj.ttl = 3600s;

Best regards,

Mike Adolphs
Stitenstrasse 24
23554 Luebeck
- Germany -

Mail. mike at

More information about the varnish-misc mailing list