A Cloudflare Load Balancing monitor marks the on-premises pool's endpoints unhealthy, yet curl to their /health path returns 200; what do you check, and how do you fix it?
answer
- read the failure reason first
- probes come from Cloudflare IPs
- which Host header the probe sends
- redirects and the first 10 KB
- Simulate Zone for client certificates
basics
~20 sRead the monitor's failure reason, then compare the probe with your curl: Cloudflare IPs blocked or rate limited, a different Host header, an HTTP-to-HTTPS redirect, an expected body beyond the first 10 KB, an untrusted certificate, or Authenticated Origin Pulls without Simulate Zone.
solid answer
~40 sStart from the reason Cloudflare records for the failed probe, then make your test match the probe. Typical causes: the on-premises firewall or a rate limiter blocks **Cloudflare IP addresses** or the `Cloudflare-Traffic-Manager` user agent (**TCP connection failed**, **HTTP timeout occurred**); the probe sends a different **Host** header, which is the endpoint address unless the monitor or endpoint sets one, and the endpoint's setting wins; an HTTP monitor hits a redirect to HTTPS (**Response code mismatch error**, fixed with `follow_redirects` or an HTTPS monitor); `expected_body` falls beyond the first 10 KB; a self-signed certificate fails (**TLS untrusted certificate error**, `allow_insecure`); or the origin requires Authenticated Origin Pulls and the monitor lacks **Simulate Zone** (`probe_zone`). Also check that the timeout is not too short.
code
json · 16 lines{
"type": "https",
"method": "GET",
"path": "/health",
"port": 443,
"header": { "Host": ["api.example.com"] },
"expected_codes": "200",
"expected_body": "ok",
"follow_redirects": true,
"timeout": 5,
"retries": 2,
"interval": 60,
"consecutive_down": 2,
"consecutive_up": 2,
"probe_zone": "example.com"
}go deeper
Remember that health probes come from Cloudflare's addresses and must be allowed through the origin's firewall.
Know the monitor fields that shape a probe: type, path, Host header, expected codes and body, follow redirects, timeout and retries.
Work from the recorded failure reason, reproduce the probe exactly, and fix the mismatch, such as Host precedence, redirects, the 10 KB body limit or Simulate Zone.
Set rules for health endpoints across teams: cheap, static, allowed from Cloudflare ranges, with probe regions and intervals budgeted against origin load.
## Why your curl proves little A successful `curl https://10.20.0.5/health` from your laptop tests a different request from the one Cloudflare sends. A Load Balancing monitor probe: - comes from **Cloudflare IP addresses**, three data centers in each selected **Health Monitor Region**; - carries the user agent `Mozilla/5.0 (compatible; Cloudflare-Traffic-Manager/1.0; +https://www.cloudflare.com/traffic-manager/; pool-id: $poolid)`, which cannot be overridden; - sends the **Host** header configured on the endpoint, else the one on the monitor, else the **endpoint address** itself; - judges the reply against the monitor's `expected_codes`, optional `expected_body`, `timeout` and `retries`. An endpoint becomes unhealthy when most probing regions fail it, a region failing when most of its three data centers do. So a failure across the board points to a systematic difference between your curl and the probe, not to one bad network path. ## Step 1: read the reason Before guessing, read why the probe failed. Load Balancing **Logs** record every endpoint status change, and the API's List Health Monitor Events (`GET user/load_balancing_analytics/events`) gives a per-data-center breakdown that includes the failure reason. The reason names the class of fault: | Reason | Usual cause | Fix | |---|---|---| | **TCP connection failed** | firewall refuses Cloudflare's source addresses | allow Cloudflare's IP ranges on the probe port | | **HTTP timeout occurred** | timeout of 1-2 seconds, or a slow or rate-limited health path | raise **Timeout**, exempt the probes from rate limits | | **Response code mismatch error** | status not in `expected_codes`, often a 301, 302 or 303 from HTTP to HTTPS | use an HTTPS monitor or set `follow_redirects` | | **Response body mismatch error** | `expected_body` not found | keep the marker static and inside the first 10 KB | | **TLS untrusted certificate error** | self-signed origin certificate | a publicly trusted certificate, or `allow_insecure` | | **TLS name mismatch error** | the probe's Host does not match the certificate | correct the monitor's or endpoint's `header` | ## Step 2: make the probe and your test agree 1. **Network and rate limits.** On-premises sites often allow only known office ranges, or put a rate limiter in front of everything. Probes from many data centers, every interval, can trip it. Allow Cloudflare's published IP ranges and exempt the health path. 2. **Host header.** If the endpoint is an IP address and nothing sets `Host`, the probe sends that IP as the Host. A virtual host that only knows `api.example.com` may answer 404 or redirect. Set the Host on the monitor (`"header": {"Host": ["api.example.com"]}`), or per endpoint when endpoints need different names; the endpoint's value wins over the monitor's. 3. **Redirects.** An HTTP monitor against a server that redirects to HTTPS sees a 301 and reports a code mismatch. Switch the type to `https` or set `follow_redirects`. 4. **Body match.** `expected_body` is a case-insensitive substring searched only in the first 10 KB. A large or changing health page fails. 5. **Origin authentication.** If the origin demands Cloudflare's client certificate through **Authenticated Origin Pulls**, the probe must egress with the zone's settings. Set **Simulate Zone** (`probe_zone`) to that zone; the same applies when the zone relies on Argo Smart Routing, Dedicated CDN Egress IPs or HTTP/2 to Origin. 6. **Timing.** Retries go out immediately after a timeout, so a 5-second timeout with 2 retries spends about 15 seconds before one probe cycle fails. The interval only separates successful cycles. ## Step 3: stop flapping without hiding outages Once probes pass, decide how quickly status should flip. The API's `consecutive_down` and `consecutive_up` require several failures or passes in a row before the status changes, which damps a noisy link. A shorter interval detects failure sooner but adds probe load: each selected region probes from three data centers, and **All Data Centers** (Enterprise) probes from every Cloudflare data center. The minimum interval depends on the plan, down to 10 seconds on Enterprise. ## A corrected monitor for the on-premises pool ```json { "type": "https", "method": "GET", "path": "/health", "port": 443, "header": { "Host": ["api.example.com"] }, "expected_codes": "200", "expected_body": "ok", "follow_redirects": true, "timeout": 5, "retries": 2, "interval": 60, "consecutive_down": 2, "consecutive_up": 2, "probe_zone": "example.com" } ``` The same shape is in the code example. After changing it, watch the pool's health and the Logs until every probing region reports the endpoints healthy before you count on the pool for failover.
- Which Host header does a Cloudflare health probe send when both the monitor and an endpoint set one?The endpoint's. A Host override on an individual endpoint takes precedence over the monitor's, which applies to every other endpoint. With neither set, the probe uses the endpoint address as the Host. That is why one pool can mix endpoints for different virtual hosts behind one monitor.
- Why can probes overload a small on-premises origin, and what do you change?Every selected region probes from three data centers on every interval, and All Data Centers probes from every Cloudflare data center. Several regions with a short interval multiply quickly. Probe from fewer regions, lengthen the interval, and keep the health path cheap rather than turning probes off.
- A 200 from my own curl proves the monitor is wrong
- The probe always sends the load balancer hostname as Host
- expected_body must match the whole response exactly
- Retries wait for the next interval before probing again
- Turning off the monitor is a safe way to stop false alarms