When your server is down
If your WordPress server stops responding, Edge Caching can keep serving the pages it has cached. Whether a given visitor sees your site or an error page depends on two things: whether Always Online is enabled, and whether the page they ask for is in the cache.
At a glance
Section titled “At a glance”| The page a visitor requests | Always Online enabled | Always Online disabled |
|---|---|---|
| Cached less than an hour ago | Served normally | Served normally |
| Cached more than an hour ago, within the stale period | Served from cache | Error page |
| Not in cache, or older than the stale period | Error page | Error page |
Never cached: logged-in users, cart, checkout, /wp-admin |
Error | Error |
The stale period is the Always Online setting that decides how long an expired page remains available: 24 hours by default, up to 48 hours.
Why most visitors are unaffected
Section titled “Why most visitors are unaffected”Popular pages are refreshed every hour, so at any moment they are in the cache. When your server fails, Edge Caching keeps serving them from the cache for as long as the stale period allows, and tries to refresh them in the background. As soon as your server answers again, pages are refreshed and visitors receive current content.
The visitors who do see an error are the ones requesting a page nobody has viewed recently, or a page that is never cached. Turning on scheduled cache warming keeps more pages in the cache and shrinks the first group.
What counts as “down”
Section titled “What counts as “down””Edge Caching treats your server as failing when it:
- refuses the connection, or does not accept it within 5 seconds;
- does not start answering within 60 seconds;
- stops sending data for more than 10 seconds;
- answers with a server error (any
5xxstatus), for example a PHP fatal error or a database connection failure.
A slow page that answers within these limits is not a failure.
The error page
Section titled “The error page”When a page cannot be served, the visitor sees a maintenance page saying the
site is temporarily down. Its HTTP status is 503 when your server could not
be reached, or your server’s own 5xx status when it answered with an error.
The page is never cached, so each new request tries your server again.
Example
Section titled “Example”Your site has Always Online enabled with the default 24-hour stale period. Your database fails at 14:00 and is fixed at 18:30.
| Page | Last cached | During the outage |
|---|---|---|
| Home page | 13:40 | Served from cache all afternoon |
| A blog post | 09:15 | Served from cache |
| An article nobody has read in three days | Not in cache | Error page until 18:30 |
| Checkout | Never cached | Error page until 18:30 |
The health check
Section titled “The health check”While Always Online is enabled, Edge Caching checks your home page every
10 seconds and expects an HTTP 200. This check drives the server status
shown in the admin and the origin down alerts you can configure under
Settings → Alerts. It does not decide what visitors see: that is
determined by each request, as described above.
| Term | Meaning here |
|---|---|
| Grace | Varnish’s name for the stale period: how long an expired object can still be delivered. 10 seconds when Always Online is disabled. |
| Stale copy | An expired page served while a fresh one cannot be obtained. |
| Background fetch | The refresh Varnish starts when it serves a stale copy. If it fails, the stale copy is kept and the next request retries. |
| Health probe | The periodic check of your home page: GET / every 10 seconds, 5-second timeout, healthy when 3 of the last 5 checks succeed. |