Back to Cloudflare

Troubleshoot From DNS to Origin to Worker

November 5, 2026 Wasil Zafar 30 min read

Use a layered runbook rather than random configuration changes

Table of Contents

  1. Prove the Name and Route First
  2. Separate TLS Failures From Origin 52x Errors
  3. Check Cache and Security Decisions
  4. Follow the Worker and Its Bound Resources
  5. Investigate a Set of Deliberately Broken Test Scenarios
  6. Write a Root-Cause Report for Each Observed Symptom

Prove the Name and Route First

Consider a composite incident, assembled from failure modes in this series rather than one customer. At 09:12, three people report three different problems with the same store. A customer in Frankfurt sees "Web server is down." A colleague in Toronto sees yesterday's prices. An automated probe gets HTTP 403. The on-call engineer disables the WAF, then a cache rule, then DNSSEC. By 09:40 the site is worse and nobody can say which change mattered.

One deploy touched four layers, and each observer saw a different layer fail. A layered runbook replaces guessing with one question: how far did this request get, and which layer wrote the last piece of evidence?

A useful analogy is courier tracking. A parcel's scan history proves handoffs, not the condition of the box. cf-ray is that tracking number for an HTTP request, and the other response headers are the scan events.

Terms first:

  • Authoritative DNS holds the zone's records. A recursive resolver asks on the client's behalf and caches the answer for the record's time to live (TTL).
  • A proxied record (the orange cloud) answers with Cloudflare anycast addresses instead of your origin, so HTTP passes through the edge. A DNS-only record answers with the origin address and never touches the HTTP path.
  • Anycast announces one address from many data centers; the chosen one is the point of presence (PoP), reported as colo by /cdn-cgi/trace and in the Ray ID suffix.
  • SNI is the hostname requested during the TLS handshake; it selects the certificate and zone configuration.
  • A Ray ID is the cf-ray value, for example 8f2c1d4e9a7b6c5d-SJC. The edge adds it and forwards it to the origin, so it can join both logs.

The order is deliberately boring: name, route, TLS, cache or security decision, Worker, origin. Each layer can end the request before the next runs, so evidence from a later layer is absent, not negative. If a request never reached the cache, "the cache is fine" is not a finding.

Start with the name. Query the exact hostname twice and keep both answers and TTLs: a TTL that counts down between queries is a cached answer, while a TTL that resets came from the authoritative server. Check delegation before suspecting the record itself.

# First run: both address families, note each TTL
dig +short A shop.example.com
dig +short AAAA shop.example.com

# Second run: a TTL that counts down was cached; one that resets was not
dig +short A shop.example.com

# Who is authoritative, and where does delegation break?
dig +short NS example.com
dig +trace shop.example.com

# A validating resolver returns SERVFAIL: re-ask without validation
dig +cd shop.example.com

# One request that prints status and headers, with no body
curl -sS -D - -o /dev/null https://shop.example.com/

Proxied records use Auto TTL, which is 300 seconds and cannot be edited, so propagation is bounded at the resolver but not at every intermediate cache. Negative answers are cached too, so a name that did not exist can keep returning NXDOMAIN after you create it.

Next, prove the route with one request that prints status and headers, then read the response the way an operator would:

Response evidenceWhat it provesWhen it is missing
cf-rayThe name resolved and the request reached a Cloudflare PoPDNS or the client path still needs work
server: cloudflareThe edge answered rather than the origin directlyThe record may be DNS-only
cf-cache-statusWhether the cache was consulted, and its outcomeAn edge-generated response, such as a block, never reached cache
ageHow long the cached entry has existedNo cache entry was served
HTTP statusWhich layer wrote the last responseNo HTTP response completed

A Ray ID is the first hard proof. It shows the name resolved and the request reached a PoP, so DNS is no longer the suspect; a timeout with no Ray ID means the request likely never reached Cloudflare — a client-path or ISP problem. That kills the most common false hypothesis.

Figure 1 turns that into a ladder with explicit stop points; the point is not exhaustiveness, but making the next test the only reasonable one.

Prove the Name and Route First
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    S["Symptom with URL and UTC time"] --> D["1. DNS: dig answer and TTL"]
    D --> DQ{"Expected edge address?"}
    DQ -->|no| DX["Stop: delegation, record, or negative cache"]
    DQ -->|yes| T["2. TLS: certificate and handshake"]
    T --> TQ{"HTTP status received?"}
    TQ -->|no| TX["Stop: browser-to-edge TLS"]
    TQ -->|yes| R["3. Route: cf-ray, colo, server"]
    R --> RQ{"cf-ray present?"}
    RQ -->|no| RX["Stop: request never reached the edge"]
    RQ -->|yes| C["4. Cache and security headers"]
    C --> CQ{"Edge-generated 4xx?"}
    CQ -->|yes| CX["Stop: Security Events by Ray ID"]
    CQ -->|no| W["5. Worker: outcome and trace"]
    W --> WQ{"Worker on this route?"}
    WQ -->|yes| WX["Worker evidence decides"]
    WQ -->|no| O["6. Origin: 52x and direct test"]
    WX --> O
    O --> Z["One root-cause claim with recovery evidence"]
    classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
    classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
    classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
    classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
    classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
    class DQ,TX,RX,CQ,O,Z primary;
    class S,D,DX,T,TQ,R,RQ,C,CX,W,WQ,WX secondary;

Figure 1 encodes one habit that matters more than any command.

Change one thing, then re-run the same request

A different URL, a different client, or a five-minute gap introduces new variables. Keep a control hostname that shares the zone but not the Worker route or the cache rule, and compare the two. The comparison is what turns a guess into a finding.

Where each layer can stop a request A browser resolves a name through a resolver, reaches a Cloudflare point of presence where TLS, cache, security, and Worker decisions happen, and then may reach an origin. Evidence cards below each boundary list what that boundary can prove. Browser or probe Resolver caches by TTL asks authoritative Cloudflare edge: anycast PoP TLS termination Cache decision Security decision Worker route Origin application and its TLS listener Boundary 1: name to route dig A / AAAA, TTL countdown NS delegation, CNAME flattening SERVFAIL with +cd, NXDOMAIN proxied versus DNS-only answer Boundary 2: edge decisions certificate chain, SNI, cf-ray, colo cf-cache-status, Age, Cache-Control Security Events matched by Ray ID Worker outcome and trace spans Boundary 3: edge to origin 520 to 526 and their conditions 19 s SYN, 90 s ACK, 125 s read origin certificate on port 443 origin log joined by Ray ID A missing header is not a passing test: it usually means the request stopped earlier. Collect evidence at the last boundary that produced any, then test the next one directly. Figure 2 scope: one proxied hostname, one client, one UTC time window.

Figure 2 makes the boundaries explicit. Evidence from boundary 2 cannot explain why boundary 3 refused a connection, and a clean dig at boundary 1 does not excuse a 526 at boundary 3. Collect the last piece of evidence that exists, then test the next hop.

Separate TLS Failures From Origin 52x Errors

TLS is two connections: browser to edge, and edge to origin. The encryption mode governs the second; the certificate the browser sees belongs to the first. Most "SSL is broken" tickets collapse the two, which is why teams replace the wrong certificate.

Split the two connections. A browser-to-edge failure usually produces no HTTP status: the browser reports a certificate error and curl exits 60, so there is no Ray ID because no HTTP response completed. An edge-to-origin failure under Full or Full (strict) does produce a response — 525 when the handshake fails, 526 when Cloudflare cannot validate the origin certificate. Both are TLS failures, and that overlap is the trap.

Same hostname, same minute, two different owners — and two different fixes. Run each leg separately and keep the results:

# Leg 1: browser to edge. Fails before headers with exit 60 when the
# edge certificate is not trusted; no Ray ID exists for the attempt.
curl -vI https://shop.example.com

# Leg 2: edge to origin. A status and cf-ray here mean the edge
# finished its own handshake and then rejected the origin.
curl -sSI https://shop.example.com

# Read what the edge presents: leaf subject, issuer, validity dates.
openssl s_client -connect shop.example.com:443 \
  -servername shop.example.com -showcerts

# Keep the hostname and SNI, but connect to the origin address.
curl -svo /dev/null https://shop.example.com \
  --connect-to ::203.0.113.34

The --connect-to form keeps the hostname and SNI while connecting to the origin address, which is how Cloudflare documents separating origin behavior from edge behavior. curl -k answers only whether the origin responds when validation is skipped; it is a diagnostic, never a fix.

Figure 3 shows the branch structure. The first branch is "did any HTTP status come back?", because that single observation decides whether you are debugging a certificate or a connection.

SymptomFailed legEvidence to captureFirst safe action
Browser certificate error, curl exit 60, no cf-rayBrowser to edgeopenssl s_client -showcerts leaf issuer, subject, expiry; SNI usedConfirm the hostname is covered by an edge certificate and that the chain is complete
HTTP 526 with cf-rayEdge to origin, validationOrigin certificate via --connect-to; hostname match, expiry, issuer chainFix the origin chain or expiry; do not weaken Full (strict) as a permanent fix
HTTP 525 with cf-rayEdge to origin, handshakeOrigin TLS listener, supported versions and ciphers, origin error logCheck that the origin accepts TLS on the configured port and protocol
HTTP 522 with cf-rayEdge to origin, network or ACKDirect origin test from another network; origin firewall rules for Cloudflare IPsCheck SYN reachability and firewall before changing TLS settings
HTTP 520 with cf-rayEdge to origin, malformed responseOrigin log at the same Ray ID; response size; headers over 128 KBLook for a crash, an empty reply, or oversized cookies and headers
HTTP 524 with cf-rayEdge to origin, slow responseOrigin request duration; the 125-second proxy read timeoutProfile or queue the slow work; do not retry it harder
HTTP 523 with cf-rayEdge to origin, no routeOrigin IP, route table, VPC or firewall pathFix routing or the origin address, not the certificate

The 52x family is narrower than "the server is down." Error 520 means the origin returned an empty, unknown, or unexpected response — a crash, a security plugin blocking Cloudflare IPs, headers over 128 KB, or malformed responses. Error 521 means the origin refused the connection. Error 522 means no SYN+ACK within 19 seconds, or no ACK within 90 seconds.

The remaining codes split the same way. Error 523 means no route to the origin. Error 524 means the connection succeeded but no body arrived before the 125-second proxy read timeout. Error 525 is a failed handshake; 526 is a certificate Cloudflare could not validate.

Two codes that mislead

A 522 is not proof that TCP never established, because a timeout while TLS is pending can be reported as 522 rather than 525. And 502 and 504 can come from the edge or the origin, so "5xx means Cloudflare" is invalid; read the body, Ray ID, and origin log.

Figure 3 also marks where one test is inconclusive. A 522 from one network and a 200 from another points at routing or a firewall, not the application.

Separate TLS Failures From Origin 52x Errors
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    Q["HTTPS request fails"] --> H{"Any HTTP status?"}
    H -->|no| A["Browser or curl TLS error"]
    A --> A1["openssl s_client -showcerts"]
    A1 --> A2{"Chain valid for hostname?"}
    A2 -->|no| A3["Edge certificate: issuance or coverage"]
    A2 -->|yes| A4["Client trust, SNI, protocol, or HSTS"]
    H -->|yes| B{"Status 525 or 526?"}
    B -->|yes| B1["Edge-to-origin TLS under Full or Full strict"]
    B1 --> B2["curl --connect-to origin IP"]
    B2 --> B3{"Origin certificate valid?"}
    B3 -->|no| B4["Fix origin chain, expiry, or hostname"]
    B3 -->|yes| B5["Check SNI, port, and mode alignment"]
    B -->|no| C{"Status 520, 521, 522, 523, or 524?"}
    C -->|yes| C1["Edge-to-origin reachability or time"]
    C1 --> C2["Check firewall, route, 19 s SYN, 125 s read"]
    C -->|no| D{"Status 502 or 504?"}
    D -->|yes| D1["Edge or origin: read body and both logs"]
    D -->|no| D2["Origin application: join its log by Ray ID"]
    classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
    classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
    classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
    classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
    classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
    class A3,B1,B2,B4,C1,C2,D1,D2 primary;
    class H,A1,A4,B5 secondary;
    class A2,B3 ok;
    class Q,A,B,C,D danger;

Not every knob exists on your plan

The 125-second proxy read timeout is adjustable only for Enterprise zones, so a smaller origin timeout may be the practical fix elsewhere. Dashboard error analytics uses a 1% traffic sample, so it finds patterns, not individual requests; the Ray ID lookup is the per-request tool. Do not turn an Enterprise-only setting into advice for every reader.

Check Cache and Security Decisions

Cache and security produce the same complaint — "the site is wrong" — and require different evidence. The CF-Cache-Status header is the cache's own account of what happened. Read the value together with Age; each one implies a different next test.

Cache statusMeaningNext test
HITServed from cache; Age is the entry's age since admission or revalidationConfirm the cache key and the rule that matched
MISSEligible but absent, so the origin was askedCompare age and Cache-Control across two requests
EXPIREDPresent but stale, so the origin was asked againCheck whether the origin sent a fresh response
REVALIDATEDA conditional request confirmed the cached copyTreat the stored entry as current
UPDATINGAn asynchronous stale-while-revalidate refresh serves the stale copy meanwhileWait for the refresh, then re-read age
STALEExpired, and the origin was unreachable, so the stale copy was servedInvestigate origin reachability, not the cache
BYPASSA candidate at request time, but the origin response refused storage: no-store, bare private, Set-Cookie, Vary: *, or an oversized objectFix the origin response or its size, not the purge
DYNAMICThe edge decided at request time that the asset was not eligibleFix eligibility; a purge cannot help
NONE / UNKNOWNNo cache lookup: a block, a redirect rule, or a Worker response with no subrequestLook earlier in the request path

The most consequential misreading is treating DYNAMIC as "the cache is cold." It means the request was never a candidate: uncached HTML or JSON, a Bypass cache setting, or Development Mode. Purging cannot fix a request that never consulted the cache. BYPASS is different: the request was a candidate, but the origin response refused storage, so the fix is in the origin headers.

A cache root cause needs recovery evidence, not a purge. Suppose the pricing page shows an old price after a deploy. Record the status, age, and Cache-Control for the exact URL, then request the same path with a distinguishing query string such as ?v=2. If the plain URL is a HIT with an old age and the variant is a MISS with fresh content, the origin is fine and one entry is stale. Purge that URL and repeat: a MISS followed by a HIT with a reset age is recovery evidence. A HIT with the pre-purge age means the purge targeted a different key — commonly apex versus www, a stripped query string, or a device variant.

Security decisions come earlier than cache lookups. A WAF custom rule that blocks a request produces a 403 (or a 1020 page) with a Ray ID and usually CF-Cache-Status: NONE/UNKNOWN, because the response never reached cache. That combination is a signal to stop debugging cache. Search Security Events for the Ray ID; the event names the service, rule, and action. Security Events may use sampled data, so a missing event is not proof that no rule matched — widen the window and check the rule's own logs before blaming the origin.

Challenges are a third outcome. A successful solve sets cf_clearance, and a command-line client never solves one, so "works in my browser, fails in CI" is often a challenge, not an outage. Some edge-generated security responses also carry cf-mitigated; when present, treat the response as produced by Cloudflare's security layer rather than your application.

Follow the Worker and Its Bound Resources

A Worker changes what "the response" means. On a matched route it runs on the request path and can synthesize a response without any origin request. The user-visible response may then carry CF-Cache-Status: NONE/UNKNOWN; if the Worker calls fetch, the subrequest gets its own cache status while the main request still reports none. Reading the main header as if it described the subrequest is a common false hypothesis.

The same layering applies to bindings. A Worker may hold KV, R2, D1, Durable Object, service-binding, or secret bindings, each an independent dependency with its own latency and failure mode. Cloudflare's tracing instruments those calls automatically: fetch calls, KV reads, R2 operations, Durable Object invocations, and RPC calls appear as spans without code changes. Custom spans can mark application stages with ctx.tracing.enterSpan, and span context exposes trace and span IDs that can be logged next to the Ray ID.

Failure codes narrow the search:

  • 1101 — the Worker threw an uncaught JavaScript exception; Workers Logs or wrangler tail shows it, and source maps make the stack readable.
  • 1102 — the Worker exceeded a resource limit; the outcome distinguishes exceededCpu from exceededMemory, which are different fixes.
  • 1027 — the free-tier daily request limit was reached.
  • 1042 — a same-zone fetch without the global_fetch_strictly_public flag, or a workers.dev URL with no Worker serving it.
  • 1024 — a subrequest targeted a Cloudflare-owned IP address.

Pull the evidence by request, not by scrolling. Stream the Worker's own log lines and keep a local copy while you reproduce the failure:

# One JSON object per line for the deployed Worker, as requests arrive.
npx wrangler tail <WORKER_NAME> --format json | tee worker-log.ndjson

Match the line to the Ray ID or trace ID you already recorded, then read the outcome and the exception. Source maps turn the stack into file and line numbers; the same trace shows which binding span was reached before the failure.

Four failures the response cannot show

Work scheduled after the response is invisible to the client. A rejection inside ctx.waitUntil cannot change the status already sent; only logs and traces show it. A try/catch that turns every binding error into a 200 makes the service look healthy while data is missing, and a binding renamed in code but not in configuration throws on first access as 1101. CPU time is not wall time either: awaiting a slow origin consumes wall time without the same CPU budget.

A composite case shows the same discipline. The api.example.com endpoint starts returning 1101 after a release while the edge is healthy, the cache header says none, and the origin sees no request. Workers Logs filtered on the error shows a TypeError on the sessions binding, and the trace has no KV span: the binding was renamed in the configuration but not in the code. Recovery evidence is the same request returning 200, a KV span in the trace, and the route's error count back at zero — no purge, DNS change, or WAF exception was involved.

Figure 4 separates what the client sees from what the operator can prove. Four failures that look similar from outside end in different places: a 1101 before the response exists, a caught binding error, an origin fetch failure, and a waitUntil rejection the client never sees.

What a Worker failure exposes to the client and to the operator A request enters a Worker handler and can fail before returning, inside a binding call, during an origin fetch, or after the response in waitUntil. Each branch is labelled with the client-visible status and the evidence available in Workers Logs and traces. Request has cf-ray Worker handler route or custom domain bindings resolved here response may be synthetic cache status may be none Throws before returning a Response Client sees 1101. Logs show the exception. Trace ends at the handler span. Binding call rejects: KV, R2, D1, service Caught: your 5xx. Uncaught: 1101. Trace marks the binding span and latency. Origin fetch fails or times out Client sees your mapped status or 1101. Fetch span shows the upstream status. waitUntil rejects after the response Client already received 200. Only logs, outcome, and traces show it. Proof available outcome: exception stack with source map binding span error name and message fetch span upstream status and time log after response Log one structured line per request: cf-ray, trace id, route, outcome, duration. Without it, four different failures look identical from the outside.

The tradeoff is real. More instrumentation means more log volume, retention cost, and redaction work. The minimum useful set is one structured line per request with the Ray ID, trace ID, matched route, binding names touched, outcome, and duration. That line is what turns "the Worker is flaky" into a bounded claim.

Investigate a Set of Deliberately Broken Test Scenarios

Guided exercise

Investigate a Set of Deliberately Broken Test Scenarios

Status: design-only. Not executed for this article. Every "expected" statement below is a prediction from documented behavior, not a measured result.

Prerequisites. No Enterprise feature is required: the exercise uses standard 52x behavior and Worker error codes, not configurable timeouts or Log Explorer. Without a separate origin, run scenarios 1, 5, 6, and 7 and record the rest as not tested.

  • Zone and origin: a Free or Pro zone, one proxied test hostname (lab.example.com), and an origin you can edit.
  • Worker: deployed on a route such as lab.example.com/api/*.
  • Local tools: dig and curl for DNS and HTTP.
  • TLS and deploy: openssl and Wrangler.

Minimal setup. Build four small pieces, then record a baseline before changing anything.

  • Origin: serve /pricing with a visible version string and a short, explicit Cache-Control.
  • Cache Rule: make /pricing eligible for two hours so you can stale it deliberately.
  • WAF: one disabled custom rule blocking requests whose User-Agent contains troubleshoot-probe on /admin.
  • Worker: reads one KV binding and returns JSON at /api/version.
dig +short lab.example.com
curl -sS -D - -o /dev/null https://lab.example.com/pricing
# keep cf-ray, cf-cache-status, Age, and the /cdn-cgi/trace colo value
#Break thisExpected signatureFailure check
1DNS-only A record on broken.lab.example.com pointing at an address with nothing listeningConnection failure with no Ray IDA Ray ID means the record is still proxied; the test proved nothing about DNS
2Proxied origin address that drops traffic522 with a Ray ID after the connect timeoutA DNS error means the record is not proxied; restore the address afterwards
3Self-signed origin certificate under Full (strict)526 with a Ray ID; --connect-to shows the same certificateSuccess under Full is a mode difference, not a fix
4Prime /pricing to HIT, then change the origin body without changing the URLOld body and growing Age; ?v=2 fresh; purge gives MISS then HITA HIT with the pre-purge Age means the purge missed the key
5Enable the WAF rule and request with the probe user agent403 or a 1020 page, Ray ID, no cache lookupAn absent event means another layer blocked it, or sampling hid it
6Rename the KV binding in code but not in configuration1101, exception in Workers Logs, no KV spanA 200 with a KV span and outcome success means the names match again
7Throw inside ctx.waitUntil after returning the response200 to the client; the failure appears only in logs or tracesA 5xx means the throw happened before the response
8Endpoint that sleeps past the read timeout524 with a Ray ID while the origin still worksA 522 means the connection never established

One signature per scenario. A correct run produces no Ray ID, 522, 526, a stale HIT, a 403 with no cache lookup, 1101, a 200 with a post-response log, and 524. Restore the address or mode after each scenario, or the next test starts contaminated; any scenario that repeats another's signature means the setup, not the hypothesis, needs fixing.

Cost is wall-clock only. DNS queries are free; a handful of Worker invocations and proxied requests is negligible; no add-on is required. The 524 test simply occupies a connection for over two minutes. Cleanup: delete the WAF rule, the Cache Rule, the Worker route, the test records, and the broken hostname, then purge the zone once and confirm the baseline request is 200 with the expected headers.

Write a Root-Cause Report for Each Observed Symptom

The deliverable is a falsifiable paragraph, assembled from evidence in this order:

  • Request identity: UTC timestamp, exact URL, client, network, and Ray ID.
  • Name and edge: DNS answer and TTL; HTTP status; certificate observation per TLS leg.
  • Cache and security: cache status and age; security event matched by Ray ID.
  • Worker and origin: outcome, trace ID, direct-to-origin result, and the single change that was made.

Keep failing and passing requests close in time and input, and state which layer's evidence is missing rather than treating absence as success. "No WAF event" is weak; "no WAF event and cf-cache-status: HIT" is stronger, because it locates the decision that actually happened.

Pass/fail evidence. These are acceptance criteria for the method, not lab results.

  1. P1 — Name and route proven. PASS if it has a dig answer with TTL and a failing-request cf-ray. FAIL if the first entry is a config change.
  2. P2 — TLS leg named. PASS if browser-to-edge and edge-to-origin are distinguished by a certificate observation. FAIL if "SSL error" appears without a leg.
  3. P3 — 52x tied to a documented condition. PASS if 522, 523, 524, or 526 is connected to the 19-second SYN, 90-second ACK, 125-second read, route, or validation condition. FAIL if "server down" is the explanation.
  4. P4 — Cache claim tested against key and age. PASS if status, Age, and key variant (apex versus www, query string, device) are recorded. FAIL if a purge comes first.
  5. P5 — Security decision confirmed. PASS if Security Events shows the service, rule, and action for the Ray ID. FAIL if a 403 is blamed on the origin without a lookup.
  6. P6 — Worker evidence present. PASS if the outcome (success, exception, exceededCpu, exceededMemory) and a log line or span are recorded. FAIL if a 1101 is "fixed" by redeploying without reading logs.
  7. P7 — Recovery proven with one change. PASS if the same request returns the expected result after one change, with before and after Ray IDs. FAIL if several settings changed and causality is unknown.

Self-check.

  1. A request returns HTTP 522 with cf-ray, and dig shows the correct proxied answer. Is DNS the cause? No. The Ray ID proves the request reached the edge, so resolution succeeded. 522 is edge-to-origin: no SYN+ACK within 19 seconds, or no ACK within 90 seconds. Check the origin path and firewall.
  2. After a deploy, the cache status is DYNAMIC and the page is stale. Will a purge help? No. DYNAMIC means the request was never a cache candidate — no matching rule, a Bypass cache setting, an uncached extension, or Development Mode. A purge only removes stored entries. Fix eligibility, then judge freshness.
  3. A Worker returns 200 but the downstream write failed. Where is the evidence? In logs and traces, not the status. Work scheduled with ctx.waitUntil runs after the response, so the client cannot see its failure. Filter Workers Logs by the Ray ID or trace ID.

Unresolved limitations. Ray IDs are not guaranteed unique, so a lookup can return more than one event. Security Events and dashboard error analytics may use sampled data, so a single request may not appear; absence is not proof. The 52x codes are coarse: 522 can be emitted while TLS is pending, and 520 covers several unrelated origin behaviors. Plan-gated controls such as configurable proxy timeouts and some log retention paths are unavailable on smaller plans, so a runbook step may be untestable. Finally, nothing here observes the origin's internal state or the client's local network; both need their own logs.

Verification note. Product behavior, error definitions, header semantics, and limits were checked against Cloudflare documentation on 2026-11-05 (planning baseline 2026-11-02). No hosted exercise was executed, and no latency, error rate, or cost figure is presented as measured. Command syntax is standard curl, dig, and OpenSSL usage; confirm flags for your versions.

References.

  • Cloudflare Ray ID: https://developers.cloudflare.com/fundamentals/reference/cloudflare-ray-id/
  • HTTP headers, including cf-ray: https://developers.cloudflare.com/fundamentals/reference/http-headers/
  • Time to Live for DNS records: https://developers.cloudflare.com/dns/manage-dns-records/reference/ttl/
  • Cache responses and CF-Cache-Status: https://developers.cloudflare.com/cache/concepts/cache-responses/
  • Cloudflare 5xx errors: https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/
  • Error 522: https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-522/
  • Error 524: https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-524/
  • Error 526: https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-526/
  • Connection limits and timeouts: https://developers.cloudflare.com/fundamentals/reference/connection-limits/
  • Encryption modes: https://developers.cloudflare.com/ssl/origin-configuration/ssl-modes/
  • Security Events: https://developers.cloudflare.com/waf/analytics/security-events/
  • Workers Logs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
  • Workers traces: https://developers.cloudflare.com/workers/observability/traces/
  • Workers error codes: https://developers.cloudflare.com/workers/observability/errors/
  • Gathering troubleshooting information: https://developers.cloudflare.com/support/troubleshooting/general-troubleshooting/gathering-information-for-troubleshooting-sites/

Next in the Series

In Manage Cloudflare With APIs and Infrastructure as Code, we'll explore Make permissions, ownership, state, and drift explicit.