On Wed, Aug 1, 2012 at 4:04 PM, Oddur Snær Magnússon <[email protected]> wrote:
> I´ve got multiple backends which each might have the file I´m requesting.
>
> Would it be possible to configure varnish in such a way that is tries
> multiple backends and uses the first one it finds with a 200 response ?
Maybe using restarts...
sub vcl_recv {
if (req.http.fallbackmarker) {
if (req.restarts == 1) {
set req.backend = backend_one;
} elsif (req.restarts == 2) {
set req.backend = backend_two;
} elsif (req.restarts == 3) {
set req.backend = backend_two;
}
[...]
}
}
sub vcl_fetch {
if (req.url == "/file.ext" && beresp.status != 200) {
set req.http.fallbackmarker = 1;
return (restart);
}
}
And setting option max_restarts to the number of backends you may use.
--
[]'s
Hugo
www.devin.com.br
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc