Trying multiple backends for a resource
Enno van Amerongen
enno at tty.nl
Thu Aug 2 15:37:09 CEST 2012
On 08/02/2012 01:55 PM, Oddur Snær Magnússon wrote:
>
> Seems like the fallback director is what I want, if I can get it to
> try to continue trying on 404.
>
> I could possibly map 404 to 503(temp unavailable)
>
> https://www.varnish-cache.org/docs/trunk/reference/vcl.html#the-fallback-director
>
>
the fallback director means that your secondairy backends don't get any
requests, unless the first backend is unhealthy. I'm not sure if that's
what you want.
I'm using the following setup to allow retries on different backends:
director cluster1 random {
{ .backend = backend1; .weight = 10; }
{ .backend = backend2; .weight = 10; }
...
}
sub vcl_recv {
...
set req.backend = cluster1;
...
}
sub vcl_fetch {
if (! beresp.cacheable) {
if (beresp.status == 404 || beresp.status == 500 ||
beresp.status == 503) {
if (req.restarts < 3) {
return (restart);
}
}
return (pass);
}
return (deliver);
}
Enno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120802/d7e01bef/attachment.html>
More information about the varnish-misc
mailing list