Caching non 200 results

Ken Brownfield kbrownfield at google.com
Wed Aug 24 21:51:40 CEST 2011


sub vcl_fetch {
    [...]
    if ( beresp.status == 400 ) {
        set beresp.ttl = 300s;
    }
    [...]
}

Typically done with 404s, but you can do any comparison you want with
beresp.status (>=400, etc)
-- 
kb


On Wed, Aug 24, 2011 at 11:59, Jeroen Ooms <jeroen.ooms at stat.ucla.edu>wrote:

> By default, varnish only cashes results if the backend returned a http 200
> OK. How can I set varnish to cashe HTTP 400 results as well as HTTP 200
> results? The HTTP 400 is quite frequent in my app and a request that
> resulted in HTTP 400 will always do so if it is re-requested, so I would
> like to cashe these results as well.
>
> Thanks,
>
> Jeroen
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110824/6c0f507b/attachment-0003.html>


More information about the varnish-misc mailing list