No-cache but still a HIT

Andreas Plesner Jacobsen apj at mutt.dk
Tue Oct 9 09:10:12 CEST 2012


On Tue, Oct 09, 2012 at 12:32:03PM +0530, Aanchal Gera wrote:

> I am sorry, but I am very confused here. no-cache is an attribute of
> response. Why should I check it in req?

You shouldn't. You should inspect beresp.http.Cache-Control in vcl_fetch.

> Anyway, this should not be so complicated. My simple requirement is that I
> don't want varnish to cache my esi URL. Why can't I simply set something in
> the response headers which tells varnish not to store it in cache.

You can. Varnish will set TTL based on max-age, s-maxage or Expires by default
(but you're free to override it in your VCL). For any other header you will
have to write the VCL to do that.

> I can write specific statements in varnish for that particular url, but I
> don't want to do that as there will be more such urls with time. This logic
> should be handled in my code, not in varnish.

VCL is a powerful configuration language that allows you to specify your own
policies. Perhaps you should read the documentation provided with Varnish.

-- 
Andreas



More information about the varnish-misc mailing list