Back to Cloudflare

Follow a Request Through Cloudflare

November 4, 2026 Updated November 6, 2026 Wasil Zafar 21 min read

Build a mental model of DNS, the proxy, edge code, and the origin

Table of Contents

  1. From a URL to a Reachable Server
  2. What Changes When Cloudflare Proxies a Hostname
  3. Where Caching, Security, and Workers Fit
  4. The Same Request With and Without a Proxy
  5. Draw the Journey of a Request to Your Test Site
  6. Identify Each Hop From DNS and Response Evidence

From a URL to a Reachable Server

A URL is not an address. You type the store URL and press Enter, but nothing in that string says where a server is: the host is only a name, the path only names a resource, and the scheme only promises protection. Two systems act first — one turns the name into an address, the other carries HTTP to whatever answers.

Think of mailing a letter to "the bakery on Main Street." The name is memorable but not routable; a directory maps it to a street address, and a postal system carries the envelope. If the bakery moves, the directory changes but the name does not.

Vocabulary:

  • DNS is the directory mapping names to records such as IP addresses. DNS hosting is whoever runs the zone's authoritative nameservers, independent of proxying.
  • HTTP is the request/response protocol: a method and path go out; status, headers, and a body come back.
  • The origin is the server holding your application and data, the part you operate.
  • HTTP proxying puts a reverse proxy — a server in front of an origin — on the path of web traffic, so visitors never need the origin's address. The edge is a nearby proxy location, and edge code such as Workers runs inside it.

The model is four steps: resolve, connect, exchange HTTP, and return. The browser checks its cache, then the OS cache, then a recursive resolver that walks from the root to the .com servers to the authoritative nameservers. A normal record returns your origin's IP; a proxied one returns a Cloudflare anycast address.

Figure 1 traces the hops and where trust changes hands.

From a URL to a Reachable Server
%%{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
    subgraph CLIENT["Client boundary"]
        B["Browser: https://shop.example.com/cart"]
    end
    subgraph DNSS["DNS control plane"]
        R["Recursive resolver"] --> A["Authoritative NS: A, AAAA, or CNAME"]
    end
    subgraph EDGE["Cloudflare edge boundary"]
        P["Anycast address, TLS terminates"] --> C{"Cache HIT?"}
        C -->|"yes"| E["Edge response"]
        C -->|"no"| S["WAF, Worker, cache fill"]
    end
    subgraph ORIGIN["Origin boundary"]
        O["Origin 203.0.113.10 port 443"]
    end
    B -->|"1 hostname lookup"| R
    A -->|"2 address answer"| B
    B -->|"3 HTTPS request"| P
    S -->|"4 fetch with CF-Connecting-IP"| O
    O -->|"5 response and headers"| S
    E --> B
    S --> B
    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 S,O primary;
    class B,R,A,P secondary;
    class C,E ok;

Figure 2 redraws the journey as layers; each boundary is where a party sees the request, decides, or fails.

DNS control plane Recursive resolver Cloudflare NS Browser shop.example.com Cloudflare edge boundary TLS termination WAF and rate limits Workers and cache Origin boundary Origin 203.0.113.10 3 HTTPS 4 fetch 5 response 1 lookup, 2 answer

What Changes When Cloudflare Proxies a Hostname

In the default full setup, Cloudflare becomes the authoritative DNS provider: the registrar's nameservers are replaced and Cloudflare answers every query for the zone. That alone puts nothing in front of your server. Proxying is a separate per-record switch, shown as an orange cloud; only A, AAAA, and CNAME records used for address resolution are eligible, while MX and TXT stay DNS-only.

The grey/orange toggle changes two things at once: the DNS answer and whether HTTP passes through the edge. A grey cloud returns the origin address and sends clients directly to your server. An orange cloud returns a Cloudflare anycast address and puts the edge in the path before the origin. The figure below shows both answers and paths.

DNS-only versus proxied DNS records A grey-cloud record returns the origin address and sends traffic directly to the origin. An orange-cloud record returns Cloudflare anycast addresses and sends HTTP through the Cloudflare edge before the origin. DNS only — grey cloud A www.example.com 203.0.113.10 Proxy status: DNS only DNS answer: origin address Browser Origin direct Proxied — orange cloud A www.example.com 203.0.113.10 Proxy status: Proxied DNS answer: Cloudflare anycast Browser Cloudflare edge Origin HTTP passes through The orange/grey toggle changes both the DNS answer and whether HTTP passes through the edge.

Read the record, then the path. With the zone delegated to Cloudflare, three records can behave three ways:

# Record types and proxy status inside one zone.
dig +short www.example.com A     # proxied A (203.0.113.10) -> Cloudflare anycast
dig +short mail.example.com A    # DNS-only A -> origin 203.0.113.20
dig +short example.com TXT       # DNS-only TXT for verification

Queries for www return Cloudflare anycast addresses, so HTTP passes through the edge where cache, WAF, and Workers can act. mail resolves straight to the origin, and SMTP never touches Cloudflare because the proxy only handles HTTP and HTTPS.

ConcernDNS-only (grey cloud)Proxied (orange cloud)Who owns the decision
DNS answerOrigin IPCloudflare anycast IPsRecord and proxy status
TLS terminationAt your originAt the edge, then again to the originSSL/TLS mode and origin cert
Cache, WAF, WorkersNot appliedApplied per zone rules and planZone configuration and entitlements
Effective TTLYour TTLFixed Auto, 300 secondsCloudflare
Typical failureThe origin's error or timeout520, 521, 522, 524, or 526 from the edgeWhichever layer failed
Good fitEmail, verification, non-HTTPWeb traffic on A, AAAA, CNAMERecord by record

Three boundaries follow. Cloudflare is not hosting your application merely because it proxies the hostname; the origin still runs your code and holds your data. The exception is a Worker with a custom domain, where the Worker is the origin and Cloudflare creates the DNS record and certificate. Proxying is HTTP-only; arbitrary TCP needs Spectrum or a DNS-only record.

Supported is not the same as included

The proxy and cache are available on every plan, but the Managed Ruleset, Argo, and longer proxy timeouts are not. Check the entitlement before you design around a feature.

Figure 3 follows one query through the proxy decision and its failure branches.

What Changes When Cloudflare Proxies a Hostname
%%{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["DNS query for shop.example.com"] --> PS{"Record proxied?"}
    PS -->|"DNS-only"| IP["Answer: origin 203.0.113.10"]
    IP --> D["Direct client-to-origin TLS, no cf-ray"]
    PS -->|"Proxied"| ANY["Answer: Cloudflare anycast IP"]
    ANY --> TLS["TLS handshake at nearest colo"]
    TLS --> SEC{"WAF or rate limit blocks?"}
    SEC -->|"yes"| BLOCK["Edge response, origin never contacted"]
    SEC -->|"no"| HIT{"Cache HIT?"}
    HIT -->|"yes"| SERVE["Serve from edge, cf-cache-status HIT"]
    HIT -->|"no"| CONN{"Origin reachable?"}
    CONN -->|"TCP fails at 19 s"| E522["522 connection timed out"]
    CONN -->|"no response by 125 s"| E524["524 timeout"]
    CONN -->|"untrusted certificate"| E526["526 invalid certificate"]
    CONN -->|"yes"| RESP["Origin response plus cf-ray"]
    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 IP,D,ANY,CONN primary;
    class Q,PS,TLS secondary;
    class BLOCK,HIT,SERVE,RESP ok;
    class SEC,E522,E524,E526 danger;

Where Caching, Security, and Workers Fit

Once a request reaches the edge, independent systems can answer it before your origin sees anything. The useful question is not what Cloudflare does but which layer owns the decision, and what happens when it is wrong.

TLS ownership is clearest. The visitor's certificate and protocol are edge concerns; the edge-to-origin connection follows the SSL/TLS mode. Flexible speaks HTTPS to the visitor and HTTP to the origin, so encryption is partial and an origin redirecting HTTP to HTTPS loops. Full encrypts without validating the certificate; Full (strict) validates it.

Security rules own allow, block, and challenge. A WAF block ends the request at the edge: the client gets a response with a cf-ray, the origin log stays empty, and cache status is meaningless — a feature during an attack, a trap during a false positive.

Caching owns reuse and staleness. Cloudflare caches by file extension, not MIME type: CSS, JS, images, and fonts qualify; HTML and JSON do not. One of four statuses then reports what happened:

StatusWhat it meansWhich layer decided
MISSEligible response was absent; the edge fetched the originCache, after a lookup
HITResponse came from the edgeCache
DYNAMICRequest is not cacheable under the current rulesEligibility: extension or rule
BYPASSEligible asset made uncacheable by origin headersOrigin headers or a bypass rule

Workers own programmable behavior, and they run before the cache. A Worker can rewrite a request, enforce authentication, or answer without an origin fetch. Its response often reports none/unknown because the cache was never consulted, while its own fetch() creates a subrequest with its own status. Workers also have limits: 100,000 requests per day and 10 ms of CPU per request on Free, and 50 subrequests per invocation.

A composite scenario shows the layers interacting. A team launches a product page behind a Worker that checks a session cookie, and the origin saturates. Someone sees DYNAMIC, adds a Cache Rule making that path eligible for an hour, and origin load drops.

Then the cache key decides who sees what. An anonymous visitor receives another customer's name, because the cached page was rendered for a logged-in request and the key did not distinguish them. The fix is to cache only the anonymous variant, bypass when a session cookie is present, and keep auth in the Worker ahead of the lookup.

The Same Request With and Without a Proxy

Start with the direct path. With DNS-only, the resolver returns the origin address and the browser connects straight to your server, where TLS terminates. Your log records the visitor's address, every request consumes origin capacity, and there is no cf-ray, cache, or WAF. A 200-second report still succeeds if the client waits, because nothing imposes a 125-second timeout; the tradeoff is exposure, since anyone who queries the name can aim at the origin.

Now proxy the record. The resolver returns a Cloudflare anycast address; TLS terminates at the edge, security rules and possibly a Worker run, and the cache is consulted. On a miss, Cloudflare opens a second connection to the origin with CF-Connecting-IP carrying the visitor's address.

That wait has limits. Missed TCP establishment at 19 seconds gives 522, no response within 125 seconds gives 524, and an untrusted certificate under Full (strict) gives 526. Your origin sees Cloudflare's address unless it reads the header or you use Authenticated Origin Pulls or a Tunnel.

Figure 4 compares the paths and their failure modes.

DNS-only (grey cloud) Proxied (orange cloud) Browser /cart Origin 203.0.113.10 TLS here HTTPS direct Origin IP is public. No cf-ray, WAF, or cache. Browser /cart Edge TLS, WAF cache, code Origin hidden IP Anycast IP is public. Origin sees CF-Connecting-IP. 19 s gives 522; 125 s gives 524.

The tradeoffs are about where complexity lands. Proxying adds a hop, but it is usually the nearest data center: TLS ends there, origin connections are reused, and a cache hit removes the origin round trip. Uncacheable responses can be marginally slower on first byte. Edge protection also means logs, rate limits, and client-IP handling must adapt.

Hiding the origin is not protecting it

Obfuscation only helps if the origin is otherwise unreachable. A firewall open to the world makes the hidden address cosmetic.

Boundary conditions cause surprises. Multiple A or AAAA records on one name are all proxied if any is. A proxied record anywhere in a CNAME chain proxies the chain, and a CNAME into another Cloudflare account fails with 1014. Proxied records ignore your TTL and use 300 seconds. To isolate a layer, grey-clouding removes the edge and tells you whether the fault is yours, at the cost of exposing the origin.

Draw the Journey of a Request to Your Test Site

The lab traces the same path on a domain you control. It is design-only: the commands follow the cited documentation, and only the header sample in the next section was observed live.

# Design-only lab. Python 3.9+, a current cloudflared release, and a domain on Cloudflare nameservers.
mkdir -p cloudflare-lab && cd cloudflare-lab
python3 -m http.server 8000          # serves index.html and logo.svg

cloudflared tunnel login
cloudflared tunnel create lab
cloudflared tunnel route dns lab lab.example.com
cloudflared tunnel run lab           # config.yml: url http://localhost:8000

Optionally, bind a Worker to the /api/* route on that hostname and return request.cf.colo, so the Worker step has something to compare.

Guided exercise

Draw the Journey of a Request to Your Test Site

Execution status: design-only; not executed.

Prerequisites.

  • A domain you can move to Cloudflare's nameservers, and a free account.
  • cloudflared, or a small VPS, plus curl and dig.
  • The Free plan covers DNS, proxying, cache, ten Cache Rules, and Workers at 100,000 requests per day with 10 ms CPU.

Steps. Run each step and read its pass condition.

  1. DNS answer. Run dig +short lab.example.com: two or more Cloudflare anycast addresses, not 127.0.0.1.
  2. Response headers. Run curl -sSI https://lab.example.com/: server: cloudflare, a cf-ray ending in a three-letter colo code, and DYNAMIC for HTML.
  3. Static asset. Request /logo.svg twice: MISS first, then HIT with a growing age.
  4. Cache Rule. Make /index.html eligible, purge, and repeat step 2: HIT after the first refill. Record the expression so you can remove it.
  5. Worker route. Compare request.cf.colo with the cf-ray suffix: both name the same data center. Expect none/unknown, because no cache lookup occurred.
  6. Grey cloud. Grey-cloud the record, wait 300 seconds plus local resolver cache, and repeat steps 1–2: the origin address appears and cf-ray disappears. Re-enable the proxy.
  7. Stopped origin. Stop the origin and request the page: an edge-generated 5xx naming Cloudflare, not your application.

Cost dimensions. Domain registration is typically USD 10–15 per year, registrar-dependent. The Free plan, tunnels, and this exercise's Workers volume are USD 0; Workers Paid starts at USD 5 per month.

Cleanup. Delete the tunnel route and DNS record, then the Worker route and script. Stop the server and remove the directory; do not leave a proxied record pointing at a tunnel that no longer exists.

Reading a failed lab run

  • 526 — the origin certificate is untrusted under Full (strict).
  • 524 — the 125-second read timeout was exceeded.
  • Redirect loop — Flexible is fighting an origin HTTPS redirect.
  • Repeated DYNAMIC on an asset — the asset is ineligible or bypassed by a rule.
  • BYPASS — the origin sent Set-Cookie, no-store, or private.
  • One origin address instead of anycast — the record is grey-clouded.
  • Stopped origin — a tunnel returns a tunnel-specific error; a direct origin returns 521 or 522.

Identify Each Hop From DNS and Response Evidence

Two artifacts verify the journey. The DNS answer says whether the edge is in the path; the response headers say which data center answered, whether the cache was consulted, and whether the origin was reached. Read them as pairs:

ArtifactPass looks likeFail looks like
DNS answerCloudflare anycast addresses from digOne origin address: the record is grey-clouded
Response headersserver: cloudflare and a cf-ray with a plausible coloNo cf-ray: the proxy was bypassed or DNS is still cached
Static assetMISS first, then HIT with a growing ageRepeated DYNAMIC: ineligible or bypassed by a rule
HTMLDYNAMIC until a rule opts it inHIT on a page that should be personalized
Worker routerequest.cf.colo matches the cf-ray suffixA Worker that never runs: the record is grey-clouded

A cf-ray on a name you expected to be DNS-only usually means a proxied CNAME chain, and a 522 or 524 with an empty origin log points at the edge-to-origin hop.

One live check confirms the shape. On 2026-11-04, against a Cloudflare-proxied host we do not control (curl 8.5.0, DiG 9.10.6, macOS 26.7.2):

dig +short developers.cloudflare.com A
dig +short cloudflare.com NS
curl -sSI https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg
HTTP/2 200
cf-cache-status: HIT
cache-control: public, max-age=604800, immutable
cf-ray: a556f29b2dfe2199-DUB

The address answers were 104.16.5.189 and 104.16.2.189, and the zone's nameserver was ns3.cloudflare.com. That is a proxied name on Cloudflare addresses, Cloudflare nameservers, and a header-identified cache hit — documented behavior on a host we do not control, not a measurement of your origin.

Self-check.

  • A proxied record resolves to a 104.16 address — where does TLS terminate? At the edge; a second connection to the origin follows the SSL/TLS mode.
  • Why does HTML return DYNAMIC on a fresh zone? HTML is not cached by default and no rule opted it in.
  • A Worker is routed on /api/* but the hostname is grey-clouded. Does it run? No; routes require a proxied record.
  • An origin takes 200 seconds. What does the visitor see? A 524 at the 125-second read timeout; only Enterprise zones can raise it.

Unresolved limitations. No controlled origin was deployed, so no latency, hit ratio, or failure timing was measured. Paid behavior — the Managed Ruleset, Argo, cache-tag purge, longer timeouts — was not exercised. Cache state is data-center-specific, so a HIT in one colo does not guarantee one in another. Ranges, entitlements, and limits change, and the sample reflects Cloudflare's own site.

References (verified 2026-11-04):

  • How Cloudflare works: https://developers.cloudflare.com/fundamentals/concepts/how-cloudflare-works/
  • Proxy status: https://developers.cloudflare.com/dns/proxy-status/
  • Default cache behavior: https://developers.cloudflare.com/cache/concepts/default-cache-behavior/
  • Cache response statuses: https://developers.cloudflare.com/cache/concepts/cache-responses/
  • Connection limits: https://developers.cloudflare.com/fundamentals/reference/connection-limits/
  • Error 524: https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-524/
  • SSL/TLS modes: https://developers.cloudflare.com/ssl/origin-configuration/ssl-modes/
  • HTTP headers: https://developers.cloudflare.com/fundamentals/reference/http-headers/
  • Workers limits: https://developers.cloudflare.com/workers/platform/limits/
  • Workers pricing: https://developers.cloudflare.com/workers/platform/pricing/
  • Worker routes: https://developers.cloudflare.com/workers/configuration/routing/routes/
  • Cache Rules: https://developers.cloudflare.com/cache/how-to/cache-rules/
  • Managed Rules: https://developers.cloudflare.com/waf/managed-rules/
  • Cloudflare Tunnel: https://developers.cloudflare.com/tunnel/get-started/

Next in the Series

In Accounts, Zones, Permissions, and Product Plans, we'll explore Understand resource ownership before configuring services.