Understanding Cloudflare Always Online

Learn how Always Online keeps a limited version of your site online if your origin web server goes offline.


Overview

Cloudflare’s Always Online feature ensures access to visitors for a portion of your Cloudflare-enabled website even if your origin web server is offline.  Cloudflare does not cache every page of your website.  Specifically, Always Online caches the first 10 links from your root HTML, then just the first links from each of those pages, and finally the first links from each of those subsequent pages. 

A Cloudflare crawler identifies resources to place in the Always Online cache.  For details, refer to our documentation about Cloudflare crawlers.

The Always Online crawler ignores robots.txt.

When always online is enabled, visitors see a green notification button at the top of their web page:

Always online green button

When Always Online displays content for an offline website, Cloudflare returns an HTTP status 503.  Cloudflare continually checks for the site to come back online in order to display the full website to visitors.  If the requested page is not in Cloudflare’s Always Online cache, the visitor sees the actual error page caused by the offline origin web server.  

For domains proxied to Cloudflare, Cloudflare IPs connect to your origin web server.  Security solutions can affect connections from Cloudflare unless you whitelist Cloudflare IPs.  If you observe the Always Online banner while your origin web server is online, your origin web server or hosting provider are likely blocking or rate limiting Cloudflare requests.


Best practices using Always Online

Do not use Always Online with:


Limitations

There are limitations with the Always Online functionality: 

1. Always Online is not immediately active for sites recently added to Cloudflare due to:

  • DNS record propagation (can take 24-72 hours), or
  • Always Online has not initially crawled the website. 

2. Cloudflare cannot show private content behind logins or handle form submission (POSTs) if your origin web server is offline. 

3. In order to trigger Always Online, your web server must return one of the following standard HTTP error codes: 

  • 502 or 504 timeout,
  • Cloudflare errors (521 & 523), 
  • Timeouts (522 & 524), 
  • SSL errors (525 & 526), or 
  • Unknown errors (520), except for errors due to empty replies from your origin web server.

Always Online does not trigger for HTTP response codes such as 404, 503, or 500 errors such as database connection errors or internal server errors.


Toggle Always Online

Always online is enabled by default.  To change the setting:

  1. Log in to your Cloudflare account.
  2. Choose the appropriate domain.
  3. Click the Caching app.
  4. Set Always Online to Off or On.

Alternatives to globally enabling Always Online include:

  • Using Cloudflare Page Rules to enable Always Online, or
  • Allowing your origin web server to determine which content to cache for display if your origin web server is offline:
  1. Disable Always Online,
  2. Set Origin Cache Control for your resources, and
  3. Enable stale-if-error at your origin.

Before enabling Origin Cache Control, consider the impact it has on how Cloudflare caches resources by default as well as any custom caching Page Rules you have configured. Consider setting origin cache headers that duplicate the default Cloudflare cached resources and duration.

To ensure Always Online caches resources for your site, do not set your origin web server’s Cache Control header to no-cache, must-revalidate, or max-age=0.


Related resources

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk