Default behaviour with regards to Cache-Control

Ole Laursen olau at iola.dk
Wed Feb 11 13:00:42 CET 2009


Hi!

Why doesn't Varnish respect Cache-Control: private and Cache-Control: no-cache
out of the box? My backend is a Django backend which is mostly sensible about
what it sends out. So it's a bit strange that Varnish doesn't just do the right
thing unless you configure it to do so.


I have a URL which redirects based on the clients IP-address (to auto-select the
country/currency). I tried sending out "Vary: *", but that doesn't seem to work.
So I ended up with Cache-Control: private just to find out that it didn't work
either (this is Varnish 2.0.2). I've put in

sub vcl_fetch {
  if(obj.http.Pragma ~ "no-cache" ||
    obj.http.Cache-Control ~ "no-cache" ||
    obj.http.Cache-Control ~ "private") {
      pass;
  }
}

as hinted in the introduction on the Wiki. Now it works, but I'm curious why
this isn't the default?

Ole




More information about the varnish-misc mailing list