Cannot stop Varnish from caching 403 responses

Lars Jørgensen ljorg6 at
Mon Sep 5 15:48:10 CEST 2011

On 02-09-2011 10:23, Marinos Yannikos wrote:

> So the object is getting stored in the cache despite all those headers -
> how can I prevent it (and why are 403 pages even cached)? default.vcl
> does nothing interesting, it only sets the backend based on server.ip
> and vcl_deliver clears a few headers:

AFAIK Varnish is not supposed to cache error documents, but we had the 
same problem (on 3.0.0). I added this bit to vcl_fetch:

if (beresp.status >= 400) {
   return (hit_for_pass);

You can go lower than that, but I still want to cache redirects (3xx).


More information about the varnish-misc mailing list