What's a good caching reverse proxy which can serve stale content if the underlying application becomes unavailable? [closed]

StackOverflow https://stackoverflow.com/questions/416372

Question

I'm looking for a caching reverse proxy (something like squid or varnish) with good support for serving stale content in the event of failure - in other words, if the application I'm proxying goes away or starts serving internal server errors I'd like the cache to continue to serve the last good response saved from the back end. Essentially I want the cache server to act as an extra layer of protection should something go wrong.

Has anyone configured Squid or similar to do this? Know of any products that support this out of the box?

Was it helpful?

Solution

Squid can do this in version 2.7. Specifically, use the stale-if-error directive. More details can be found at:

http://www.mnot.net/blog/2007/12/12/stale

OTHER TIPS

It looks like Varnish can't handle this requirement just yet: http://varnish.projects.linpro.no/ticket/369

It would depend on how long 'unavailable' is. Squid has a config 'refresh_stale_hit' which is mostly designed to remove some latency by allowing slightly stale content to be served while the cache is updated. Pretty sure it won't override getting a bad response from the web server, though. There is a full-on 'offline' mode that will keep serving cached results (designed for ... wait for it ... offline use!) so the code paths are in there: not sure if you can configure it to both proxy good results, and ignore bad ones.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top