How to monitor a site behind a CDN
Short answer
A public URL can stay up while a CDN, firewall, or proxy serves a cached page and the server is down. Watch a health URL the cache is not allowed to store.
How The Watchbill helps
- A check runs every minute by default, and a check can be set to 5 minutes, 15 minutes, 30 minutes, or 1 hour.
- Email goes out when a check is down and when it recovers.
- Each client can have a status page that stays private until you publish it.
This guide explains how to monitor a site that sits behind a CDN, a firewall, or a reverse proxy, and how to tell a cached answer from the server itself.
If the site sits behind a CDN, firewall, or proxy, an Up result means that service answered. It may be serving a cached copy even when your server is down. To check the server itself, point a check at a health URL that is never cached, and turn on must not be served from cache.
The public homepage and the server behind it are two different questions. Visitors care that the homepage loads. You may also have promised to notice when the server itself stops. A CDN, a web application firewall, or a reverse proxy can answer the first question with a stored page while the second question is already no. Cloudflare, Akamai, Fastly, CloudFront, Azure Front Door, Sucuri, and Imperva are examples. The same thing happens on a small Varnish or nginx proxy you run yourself. The brand on the dashboard does not change the measurement.
Why does a cached page stay green?
A normal HTTPS check requests the URL you saved and reads the status. A 200 is up. If a cache in front of the server still has a 200 from this morning, the check receives that 200. The server can be off, the process can be crashed, or the database can be refusing connections, and the status code the checker sees is still success. The outage you meant to catch is hidden behind a copy.
That is what the cache is for. The mistake is to report it as "the server is up" when you only saw the cache. If the agreement is about the public URL, a cached 200 is the right answer, because visitors got a page. If the agreement is about the server, you need a request the cache will not satisfy from storage. A firewall or reverse proxy can do the same with a stale copy or its own block page. How to read the status code is in which HTTP codes count as downtime.
What should you do?
- Decide, in writing, whether this check watches the public URL or the server behind it. One check should not pretend to be both.
- If you need the server, add a health URL that returns a small, uncacheable response, such as a 200 with a short body, and point the check at that URL.
- Tell the CDN, firewall, or proxy not to store that URL. Do this for the one path, not for the whole site. A unique query string on every request is a poor substitute: it fills the cache with one copy per check.
- Turn on "must not be served from cache" for that check, then request the URL and read the cache header. A stored copy should not count as up.
- Keep a separate check on the public homepage when the client also cares that visitors can load the cached page. Say on the status page which check is which.
The health URL has to be one the cache is allowed to skip. A homepage the CDN is configured to store will keep answering from storage. A path that sets Cache-Control: no-store, or that a cache rule skips, fails when the server fails. Do not turn caching off for the whole site. The bypass belongs on the health URL only. A meta tag in the HTML does not do this. The cache decides before a browser reads the page.
Which headers say a proxy answered?
You do not need a vendor menu to see that a proxy was in the path. The response carries headers. Read them on one request made the way the checker does, with the checker's user agent, and write down what you see.
Cloudflare documents CF-Cache-Status. HIT means the edge served a stored copy. STALE and UPDATING also serve a stored copy. DYNAMIC means the request was not eligible for cache. BYPASS means the request was eligible and the response was not cacheable. Cloudflare also sets Age when it serves HIT, STALE, or UPDATING. An Age on a DYNAMIC or BYPASS response can be one the origin set, so do not treat every Age as a Cloudflare hit. Source: Cloudflare's cache responses page, checked 10 October 2026.
Fastly documents X-Cache and X-Served-By. X-Cache is HIT when the response was satisfied from cache, including a stale object, and MISS otherwise. A PASS is reported as MISS. With shielding, the header can list more than one value. Any value other than MISS means a cache satisfied the request. X-Served-By names the cache node, often in the form cache- plus a site code. Source: Fastly's X-Cache reference, checked the same day.
Amazon CloudFront adds X-Amz-Cf-Id on the request it forwards, and the viewer response carries X-Cache. "Hit from cloudfront" and "RefreshHit from cloudfront" mean the edge used a stored object. "Miss from cloudfront" means it fetched from the origin. Source: CloudFront's origin behavior page and AWS's notes on the X-Cache header, checked the same day.
Azure Front Door attaches X-Azure-Ref on responses and an X-Cache value. Microsoft's caching page lists TCP_HIT and TCP_REMOTE_HIT as served from the Front Door cache, TCP_MISS as fetched from the origin, PRIVATE_NOSTORE as not cached because of private or no-store, and CONFIG_NOCACHE as not cached because the route says so. Source: Azure Front Door caching and the Front Door header list, checked the same day.
Akamai can add X-Akamai- headers, including X-Akamai-Request-ID. Its diagnostic notes describe X-Cache values such as TCP_HIT and TCP_MISS. Those diagnostic headers are not on every response by default. If you see an X-Akamai- header, Akamai handled the request. This guide does not give a click-path for turning the diagnostics on. Source: Akamai's pragma header list, checked the same day.
X-Sucuri-* headers, when they are present, mean Sucuri handled the response. Via means some proxy added its name to the path. Age greater than zero means a cache has been holding the object, unless a status header above already says the origin answered this request.
| What you see | What it means for this request |
|---|---|
| CF-Cache-Status HIT, STALE, or UPDATING | Cloudflare served a stored copy |
| CF-Cache-Status DYNAMIC or BYPASS | Cloudflare did not serve a stored copy |
| X-Cache HIT, or Hit from cloudfront, or TCP_HIT | A cache served a stored copy |
| X-Cache MISS, or Miss from cloudfront, or TCP_MISS, CONFIG_NOCACHE, PRIVATE_NOSTORE | This response was not a stored copy |
| Age greater than zero, and no miss or bypass above | A cache has been holding the object |
| X-Amz-Cf-Id, X-Azure-Ref, X-Akamai-, X-Sucuri-, X-Served-By, or Via | A CDN or proxy was on the path. Read the cache header before you call the server up |
What should you tell the client?
If you publish a status page, say what the green mark measured. "Website" is ambiguous. "Public homepage" and "application server" are not. A client who loads a cached homepage will not believe a page that says the site is down, and a client whose checkout is broken will not believe a page that says the site is up because the cache answered. The longer version is in what a client status page should show.
When the health URL fails and the homepage stays green, the server is in trouble and visitors may still be reading a stored page. Open the ticket for the server. Do not mark the public page down until it is. Two checks, two sentences.
Set it up in The Watchbill
Decide whether this check is measuring the public URL or the server behind it. One check shouldn't pretend to be both.
For the public URL, a normal check is enough. Leave "Site is behind a CDN or proxy" off. The check page notes "Served through a CDN or proxy", and it adds the vendor name when a header identifies one: Cloudflare, Akamai, Amazon CloudFront, Fastly, Azure Front Door, or Sucuri.
For the server, point the check at a small health URL the cache isn't allowed to store, and turn on "Site is behind a CDN or proxy". You can also turn on "Fail if the response is cached. Use with the CDN option." That checkbox is the rule this guide calls "must not be served from cache". It accepts a response that wasn't served from cache, which on Cloudflare is CF-Cache-Status of DYNAMIC or BYPASS. A hit, or an Age greater than zero without a miss or a bypass, doesn't count, and that failure is down.
The checker calls itself TheWatchbill/1.0 (+https://thewatchbill.com) on every request. When "Site is behind a CDN or proxy" is on, the same request also sends X-Watchbill-Check with this check's secret and a new X-Watchbill-Nonce.
Let the checker through by that user agent or by the X-Watchbill-Check header. Don't allow it by an IP list: the check leaves from Cloudflare, and that address isn't a stable list you can copy. A rule that matches only the header won't match a normal check, because a normal check doesn't send the header.
A Cloudflare Cache Rule only bypasses cache. It doesn't disable the WAF. If the WAF is challenging the checker, add a custom rule, choose Edit expression, set the action to Skip, and place that rule before the rules that challenge. Then choose the parts that are in the way: the remaining custom rules, rate limiting rules, managed rules, or Browser Integrity Check. This expression matches the user agent or a request that carries the header. It doesn't match every visitor.
(http.user_agent eq "TheWatchbill/1.0 (+https://thewatchbill.com)") or (len(http.request.headers["x-watchbill-check"]) > 0)
Skip can't turn off Bot Fight Mode. Cloudflare's Skip action page, checked 10 November 2026, is the source for that limit.
A response whose cf-mitigated header contains "challenge" is a refused measurement, and it doesn't open an outage. Expected status isn't consulted for that response, so an expected 403 doesn't override it.
A plain 503, with no such challenge, is down unless Expected status includes 503. Expected status can be one code (503), a list (200,503), or a range (200-299). If the code doesn't match, the check is down. Body rules on that check still apply after the status matches; Page content covers that half.
The snippets below are the ones from the check page, with YOUR_CHECK_SECRET in place of the secret. Open the check and copy the real secret from "How this check reaches the origin". It isn't on the public status page. Don't paste a real secret here.

The origin proves it handled that request by echoing X-Watchbill-Nonce and setting Cache-Control: no-store and CDN-Cache-Control: no-store on that response only. A stored copy isn't reached, even when the nonce matches.
Cloudflare Cache Rule
In the zone that proxies this hostname, open Caching, then Cache Rules, and create a rule. Choose Edit expression, paste the first line, and set Cache eligibility to Bypass cache. The rule matches only a request that carries this check's secret. It doesn't turn caching off for the site, and it doesn't turn the WAF off.
What cf-cache-status tells you:
- A bypass often shows DYNAMIC rather than the word BYPASS.
- BYPASS means the request was eligible and the origin response was not cacheable.
- HIT means the edge served a stored copy, so the origin was not reached.
In the API, Bypass cache is a set_cache_settings rule with cache set to false. Don't PUT a ruleset that contains only this rule, because that replaces every other Cache Rule on the zone. Add the rule in the dashboard, or append the object to the rules you already have.
any(http.request.headers["x-watchbill-check"][*] == "YOUR_CHECK_SECRET")
{
"description": "The Watchbill origin check",
"expression": "any(http.request.headers[\"x-watchbill-check\"][*] == \"YOUR_CHECK_SECRET\")",
"action": "set_cache_settings",
"action_parameters": {
"cache": false
}
}
Notes for each server
| Server | Notes |
|---|---|
| nginx | Put the maps in the http block and the add_header lines in the same server or location that already sets headers, because a nested add_header drops add_header lines inherited from a parent block. An empty mapped value isn't sent. Don't use if. Don't send no-store on every response; the map does that only when the secret matches. |
| Apache | Apache 2.4 with mod_headers. The block runs only when the secret matches and the nonce is a single token. |
| Caddy | The matcher is an exact header value, and the headers are set only for that request. |
| PHP | Run this before any output. On WordPress, put it in a must-use plugin, not in a post. hash_equals avoids a byte-by-byte leak of the secret. The nonce is echoed only when it's a single token, so a newline in the header can't break the response. |
| Node.js | Express middleware. timingSafeEqual throws when the lengths differ, so the length check stays. Mount it before routes that send the response. |
| Python (Flask) | after_request runs once the view has built the response. compare_digest is the constant-time compare. The same idea works in any Python stack. |
| Python (FastAPI) | HTTP middleware. The nonce is written on the response, after the route runs. |
nginx
map $http_x_watchbill_check $wb_nonce {
default "";
"YOUR_CHECK_SECRET" $http_x_watchbill_nonce;
}
map $http_x_watchbill_check $wb_nostore {
default "";
"YOUR_CHECK_SECRET" "no-store";
}
add_header X-Watchbill-Nonce $wb_nonce always;
add_header Cache-Control $wb_nostore always;
add_header CDN-Cache-Control $wb_nostore always;
Apache
<If "%{HTTP:X-Watchbill-Check} == 'YOUR_CHECK_SECRET' && %{HTTP:X-Watchbill-Nonce} =~ /^[A-Za-z0-9_-]+$/">
Header always set X-Watchbill-Nonce "expr=%{HTTP:X-Watchbill-Nonce}"
Header always set Cache-Control "no-store"
Header always set CDN-Cache-Control "no-store"
</If>
Caddy
@watchbill header X-Watchbill-Check YOUR_CHECK_SECRET
header @watchbill X-Watchbill-Nonce {header.X-Watchbill-Nonce}
header @watchbill Cache-Control no-store
header @watchbill CDN-Cache-Control no-store
PHP
<?php
$token = 'YOUR_CHECK_SECRET';
$got = $_SERVER['HTTP_X_WATCHBILL_CHECK'] ?? '';
if (is_string($got) && strlen($got) === strlen($token) && hash_equals($token, $got)) {
$nonce = $_SERVER['HTTP_X_WATCHBILL_NONCE'] ?? '';
if (is_string($nonce) && preg_match('/^[A-Za-z0-9_-]+$/', $nonce) === 1) {
header('X-Watchbill-Nonce: ' . $nonce);
}
header('Cache-Control: no-store');
header('CDN-Cache-Control: no-store');
}
Node.js
import { timingSafeEqual } from "node:crypto";
const TOKEN = "YOUR_CHECK_SECRET";
function watchbillToken(value) {
const got = Buffer.from(value);
const want = Buffer.from(TOKEN);
return got.length === want.length && timingSafeEqual(got, want);
}
export function watchbillOrigin(req, res, next) {
if (watchbillToken(req.get("x-watchbill-check") ?? "")) {
const nonce = req.get("x-watchbill-nonce") ?? "";
if (/^[A-Za-z0-9_-]+$/.test(nonce)) {
res.set("X-Watchbill-Nonce", nonce);
}
res.set("Cache-Control", "no-store");
res.set("CDN-Cache-Control", "no-store");
}
next();
}
Python (Flask)
import hmac
import re
from flask import request
TOKEN = "YOUR_CHECK_SECRET"
NONCE = re.compile(r"^[A-Za-z0-9_-]+$")
@app.after_request
def watchbill_origin(response):
got = request.headers.get("X-Watchbill-Check", "")
if hmac.compare_digest(got, TOKEN):
nonce = request.headers.get("X-Watchbill-Nonce", "")
if NONCE.fullmatch(nonce):
response.headers["X-Watchbill-Nonce"] = nonce
response.headers["Cache-Control"] = "no-store"
response.headers["CDN-Cache-Control"] = "no-store"
return response
Python (FastAPI)
import hmac
import re
from fastapi import Request
TOKEN = "YOUR_CHECK_SECRET"
NONCE = re.compile(r"^[A-Za-z0-9_-]+$")
@app.middleware("http")
async def watchbill_origin(request: Request, call_next):
response = await call_next(request)
got = request.headers.get("x-watchbill-check", "")
if hmac.compare_digest(got, TOKEN):
nonce = request.headers.get("x-watchbill-nonce", "")
if NONCE.fullmatch(nonce):
response.headers["X-Watchbill-Nonce"] = nonce
response.headers["Cache-Control"] = "no-store"
response.headers["CDN-Cache-Control"] = "no-store"
return response
A static file can't echo a fresh nonce, and a meta tag can't bypass the cache either. The Cache Rule can forward the request, and the check still can't prove the origin wrote the page. Don't turn caching off for the whole site.
If the origin doesn't echo the nonce, that minute is a refused measurement, and it doesn't open an outage. If "Fail if the response is cached" fails, the check is down. If both are on and the response is a cache hit, the minute is a refused measurement, because the origin wasn't reached.
When the check shows the Origin hostname or IP field, it only reads the origin certificate. The uptime check still requests the URL, and a failed read doesn't mark the site down. The certificate checklist spells that field out.
Keep a second check on the public homepage, and name the two checks so a client can tell them apart: one name for the public page, one name for the server.
How The Watchbill helps
The Watchbill checks each URL every minute by default, and a check can be set to 5 minutes, 15 minutes, 30 minutes, or 1 hour. When US East and US West both see the check down, one more check about 30 seconds later confirms it. If the regions disagree, the wait is about two minutes, so one odd sample does not open an incident by itself. Email goes out when that confirmed state changes.
A normal check of a public URL reports the answer it received, including a cached one. The status page says so: if the site sits behind a CDN, firewall, or proxy (such as Cloudflare, Akamai, or Fastly), an Up result means that service answered, and it may be a cached copy. To watch the server, point the check at a health URL that is never cached and turn on "must not be served from cache". That rule accepts a response that was not served from cache. On Cloudflare that is CF-Cache-Status of DYNAMIC or BYPASS. The same rule also accepts a miss or a no-cache status from Fastly, CloudFront, Akamai, and Azure Front Door, and it rejects a hit from those networks. An Age greater than zero, without one of those miss or bypass statuses, does not count as up.
When the response carries one of those headers, the check page says "Served through a CDN or proxy" and adds the vendor name when the header identifies one: Cloudflare, Akamai, Amazon CloudFront, Fastly, Azure Front Door, or Sucuri. A Via header with no vendor name still gets the neutral sentence.
You can also turn on origin reach. The check sends a secret and a fresh nonce, and the server has to echo the nonce. A stored copy cannot. The portal shows a Cloudflare Cache Rule for that header, because that is the vendor path we checked, plus snippets for the server. Other networks need their own bypass for the same URL. A meta tag is not a bypass on any of them.
The checker calls itself TheWatchbill/1.0 (+https://thewatchbill.com), which is the name to allow through a firewall. Try one health URL with a free account, and use the glossary if origin and edge are still easy to mix up.
Sources
Checked 10 Nov 2026.
- Cloudflare, Cache responses (CF-Cache-Status and Age)
- Fastly, X-Cache header
- Azure Front Door caching (X-Cache values)
- Azure Front Door HTTP headers (X-Azure-Ref)
- Akamai, Pragma headers (X-Cache and X-Akamai-Request-ID)
- Amazon CloudFront, request and response behavior for custom origins (X-Amz-Cf-Id)
- AWS re:Post, CloudFront X-Cache Hit and RefreshHit
- AWS re:Post, X-Cache Miss from CloudFront
- Cloudflare, Configure a rule with the Skip action
- Cloudflare, Available skip options
