Stale-if-error not respected for timeouts (522 errors)

I’m trying to set up my website, which is running on a raspberry pi at my home, so it’ll stay up even when my server goes down (like a power outage, restarting my router, or moving house etc).

I’ve set cache-control: public, max-age=60, stale-if-error=31536000, stale-while-revalidate=3600, seems to be correctly set up as it does indeed stay up after I shut down my server.
However, if I shut down my router, I get 522 timeout errors from cloudflare. Shouldn’t timeouts be handle the same was as other errors for the purposes of stale-if-error? Or have I mis-configured it somehow?

Appreciate any help!

Cloudflare doesn’t cache HTML by default, so it’s going to fail immediately.

There’s the “Always Online” feature that should help with this.

https://support.cloudflare.com/hc/en-us/articles/200168436-Understanding-Cloudflare-Always-Online

thanks @sdayman but I’ve successfully set it up to cache HTML already. As I mentioned in my post it does work for most errors. (I’ve shut down my server hosting https://viktorh.net/ now just as an extra proof, you should see that it works but cf-cache-status is UPDATING)

I’ve seen the always online feature but I want to avoid using it as I don’t want the people viewing my side to see all the “this website is not working here’s an old version” stuff that the “always online” mode puts in.

Ah…I see. Server shutdown is ok, but router shutdown kills it. I’m afraid I don’t know how Cloudflare cache behaves if it knows the origin doesn’t exist.

The following article touches on downtime, but doesn’t seem to provide much insight. One of the engineers is online and might know more.

https://support.cloudflare.com/hc/en-us/articles/360037465932-Preventing-site-downtime

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.