My use case is: I want to use caddy as a caching reverse proxy, which serves stale content whenever the origin server is down, a timeout occurs or origin replies with http 5xx. As storage for the cache I want to use redis. This is to use caddy as a proxy which makes a origin service more resilient to outages, and where stale content is better than no content.
Can I do this with the current caddy versions (1.x or 2.x) and if so, how does the config look like?
You can almost do this in Caddy 2. I need to make two small enhancements.
The proxy module can do this if the backend is down or a timeout occurs, but I’d need to make a small enhancement for it this to be doable if the origin replies with 5xx. I am currently mulling over a few design choices and then I can commit and push the best one.