Serve stale content if backend is healthy but "not too healthy"
Luca Gervasi
luca.gervasi at gmail.com
Tue Sep 21 13:32:05 UTC 2021
Hello everyone,
We have a backend that actually proxies different services (mangling
the original response). Sometimes one of those backends are not
available and the general response goes from 200 to a 50x.
Is there a way to serve a stale (valid) content (if present) for a
request that comes from a backend in a healthy state?
I was thinking about something like this:
sub backend_fetch {
if (beresp.status >= 500) {
return_a_stale;
}
}
>From the state machine
(https://varnish-cache.org/docs/6.0/reference/states.html) it seems
that I'm not allowed to return(hash) nor switch to an unhealthy
backend (that i keep configured) to reach what I want.
Please forgive me if do exists a facility to reach my goal and feel
free to direct me to the right document.
Ah. Varnish 6.x.
Thanks
Luca
More information about the varnish-misc
mailing list