CDN Request Flow
A CDN (Content Delivery Network) is a globally distributed network of edge servers that cache and serve content from locations geographically close to end users, reducing latency, offloading origin servers, and improving availability.
A CDN (Content Delivery Network) is a globally distributed network of edge servers that cache and serve content from locations geographically close to end users, reducing latency, offloading origin servers, and improving availability.
CDNs like Cloudflare, Fastly, and AWS CloudFront operate hundreds of Points of Presence (PoPs) worldwide. When a user requests a CDN-backed resource, DNS resolution returns the IP of the nearest edge node (often via Anycast routing) rather than the origin server's IP.
Cache Hit Path: If the edge node has a valid cached copy of the requested resource (determined by URL, headers, and cache policy), it serves the response immediately without contacting the origin. This is the "fast path" — latency is dominated by the user-to-edge RTT, typically 5–20ms for well-distributed CDNs.
Cache Miss / Origin Fetch: On a cache miss (first request for a resource, or after TTL expiry), the edge node forwards the request to the origin server (your application server or object storage). The response is cached at the edge according to Cache-Control headers, then returned to the client.
Cache Invalidation: CDNs allow programmatic cache purging via API. This is necessary for deployments where content changes but cache TTLs haven't expired (e.g., after deploying new JavaScript bundles). Some CDNs support surrogate keys (cache tags) for selective bulk invalidation.
TLS Termination: CDN edge nodes terminate TLS connections, meaning your origin receives plain HTTP (or HTTP over a private network). This offloads TLS computation from your origin and enables CDN visibility into request contents for security filtering.
CDNs work closely with load balancers at the origin tier and reverse proxies for request routing.