CDN Deep Dive: Content Delivery Networks Explained
Follow a CDN request through routing, cache keys, misses, origin fetches, and purges. Learn how HTTP freshness and provider routing shape the result.
A CDN routes requests through an edge network, checks for a reusable cached response, and fetches misses from an origin. The route is selected by network and provider behavior, not guaranteed geographic distance. This guide traces a request, explains cache keys and freshness, and shows where routing, origin protection, and purging fit.
CDN Deep Dive: Content Delivery Networks Explained
A content delivery network (CDN) places an edge layer between clients and an origin. It can return a reusable response from an edge cache or forward a miss to the origin. Routing, cache rules, and origin configuration determine the result; a CDN does not make every request faster by default.
Last verified: 2026-11-08. Routing and cache controls vary by provider and can change. The walkthrough below is illustrative; check the selected CDN’s current documentation before applying product-specific settings.
The request path
A request usually follows these steps:
- DNS and network routing direct the client toward an edge point of presence (PoP). The selected PoP is not guaranteed to be the geographically closest one. With Anycast, routing depends on advertised routes and network policy; providers can also use their own steering mechanisms. See RFC 4786 and Cloudflare’s explanation of geographic routing.
- The edge applies the configured cache key and policy. The key commonly includes the URL and may include selected request fields, cookies, or query parameters.
- On a cache hit, the edge returns a fresh cached response, or follows the configured revalidation/stale-response behavior.
- On a miss, the edge forwards an eligible request to the configured origin. The response returns through the edge and may be cached according to the CDN policy and HTTP cache directives.
- A later purge or expiration removes or invalidates the cached object. The next eligible request may need to fetch it again.
One illustrative request
Suppose a site requests /assets/app.a91f.js, a versioned public asset. The first request reaches an edge with no matching object. The edge requests it from the origin, forwards the response, and stores it if the cache rules allow. A second request with the same cache key can be a hit. If the origin deploys different bytes at the same URL, users could receive the old object until expiry or purge; content-hashed filenames avoid that ambiguity by giving changed bytes a new URL.
For a private account response, caching across users would be unsafe. The origin can mark it private or no-store as appropriate, and the CDN should be configured so authentication or personal data cannot enter a shared cache. HTTP cache semantics are defined in RFC 9111; provider rules may add controls, but should not contradict the intended privacy boundary.
Cache keys and freshness
A cache key decides which requests may share a stored response. If the representation varies by language or encoding, the response and cache configuration must account for that variation. Including too little can serve the wrong representation; including every query parameter or cookie can fragment the cache and lower reuse. Keep the key limited to fields that actually change the response.
Freshness is controlled by HTTP directives and, in some products, separate edge rules. Check both the origin response and CDN configuration. Cache-Control: public, max-age=... can allow shared caching when the content is safe to share; private limits storage to private caches, while no-store says not to store the response. Revalidation directives can let a cache check whether a stored response is still current. Review RFC 9111 before treating a CDN dashboard setting as a substitute for HTTP semantics.
Cache invalidation is an operational choice. A short TTL bounds how long an old response may remain but increases origin fetches. A purge can remove selected objects sooner, but depends on the CDN’s APIs and propagation behavior. Versioned URLs are often simpler for static assets. For related cache design decisions, see Cache Patterns, Cache Eviction Policies, and Cache Stampede Prevention.
Routing and transport
Anycast lets multiple network locations announce the same IP prefix. BGP and upstream routing select a path, but path length does not mean physical distance, and route changes can shift traffic between PoPs. Provider documentation describes the behavior of each service. For example, Amazon CloudFront’s request path describes how it selects an edge location, checks the cache, and forwards misses to an origin.
HTTP/3 runs HTTP over QUIC; it can reduce connection setup costs in some network conditions, but it does not guarantee lower latency for every client or request. See the HTTP/3 specification, RFC 9114. Check browser, client, and provider support before relying on a transport feature.
Operational checks
When a response is slow or incorrect, inspect one request from client to origin:
- Which PoP handled it, and what route or steering policy selected it?
- Was it a hit, miss, revalidation, or bypass? Check response headers and CDN logs.
- Did the cache key include the fields that change the response, and exclude irrelevant fields?
- Did the origin return cache directives that match the data’s privacy and freshness needs?
- If purged, did the provider confirm the requested objects or tags were invalidated?
- Can the origin absorb a miss burst or purge event? Use request coalescing, stale serving, or rate limits where appropriate; see Cache Stampede Prevention.
A CDN is one layer in an end-to-end cache path. For application and data-store choices, continue with Caching Strategies.
Category
Related Posts
Network Performance: Latency, Throughput, Jitter & Loss
Learn to measure link capacity, throughput, delay variation, packet loss, and response time with ping, iperf3, and curl.
Load Balancing: Traffic Control for Modern Infrastructure
Learn how load balancers distribute traffic across servers, the differences between L4 and L7 load balancing, and when to use software vs hardware solutions.
Forward and Reverse Proxies: Routing, Trust, and Use Cases
Learn how forward and reverse proxies handle HTTP traffic, CONNECT tunnels, TLS termination, caching, routing, trusted headers, and production failures.