Cache but keep off until required

Hello,

Possibly a silly question but here goes. I want to make use of cloudfare for redundancy. So that if my webserver goes down the site can still be up due to files being served by cloudfare.

However issue is the site is powered by a cms and good rules for purging cache via cloudfare api would be a real pain. So was wondering is it possible to have stuff cached in cloudfare but site to be served from cms and only in instance of site being down i can turn on in cloudfare?

I know there is development mode which turns of after 3hrs but i am guessing that would serve up snapshot from 3hrs ago?

That is not how the cache works. There is “always on” but that does not take data from the cache either and is not always a hundred percent reliable.

You’d need to have page rule to cache everything and even then you might run the risk that something gets purged at any time and Cloudflare attempts to contact your unresponsive server.

Sandro,

Many thanks for the reply, didn’t think it was possible either but thought i would ask :slightly_smiling_face:

You can certainly try a cache everything page rule along with a longer edge cache TTL, but I wouldnt take this as guarantee that your site will be up in case your server is down. But as you pointed out, that cache would also apply if your site is actually up.

At best you could try to come up with something using workers, where the worker skips the cache if it determine the server to be up and uses the cache in all other cases. That could work but it would require the worker to run on all paths, meaning you will be charged for each request.

This topic was automatically closed after 14 days. New replies are no longer allowed.