termEngineering & architecture

Content Delivery Network (CDN)

A geographically distributed service that delivers content from edge locations closer to users and shields an origin from repeated requests.

Download Markdown (.md)

01What it means

A content delivery network (CDN) routes requests through distributed edge locations that can cache or otherwise accelerate content from an origin server. The edge may serve a reusable response locally or retrieve it from the origin, while also providing traffic management and security capabilities depending on the service.[1][2]

Distributed delivery path The edge serves reusable content close to the requester
  1. User requestRouted to an edge
  2. CDN edgeFresh hit serves locally
  3. Origin serverMiss retrieves content

Eligible responses are cached at the edge

A miss continues to the origin; policy controls freshness and failure.

02Why it matters

A CDN can reduce user latency, bandwidth cost, and origin load while improving resilience to traffic spikes and some attacks. Because it sits in the delivery path, its cache, routing, certificate, and configuration choices directly affect correctness, privacy, and availability.

03When to use it

Use a CDN for globally or regionally distributed users, cacheable static assets, media, downloads, and suitable dynamic delivery. It may add little value for local audiences, private low-volume systems, or responses that cannot be safely cached, although non-cache acceleration may still help.

04How it works

  1. Configure DNS or routing so user requests reach the CDN before the origin.
  2. The CDN selects an edge location based on network and service conditions.
  3. The edge builds a cache key and serves a fresh matching response when available.
  4. On a miss, the edge requests the content from the origin, returns it, and stores it when policy permits.
  5. Teams control freshness, variation, invalidation, origin access, TLS, and failure behavior.
  6. Monitor edge and origin latency, hit rates, errors, geography, cost, and configuration changes.

05A practical example

Example

A documentation product serves versioned JavaScript, images, and public pages through a CDN. Long-lived cache headers make fingerprinted assets inexpensive, while short-lived HTML is revalidated; origin access is restricted so attackers cannot bypass edge protections.

06Where it breaks

A CDN adds another provider and configuration layer, cannot repair a slow or incorrect application, and may serve stale or mis-keyed private content. Cache misses still reach the origin, geographic coverage varies, invalidations take time, and outages or routing errors can affect many users at once.

Common mistakes

  • Putting a CDN in front of a site without defining cacheability, keys, freshness, and invalidation.
  • Caching personalized or authorized responses without safely varying or disabling shared reuse.
  • Leaving the origin publicly bypassable while assuming edge security controls cover it.
  • Judging performance only at the edge and ignoring cache misses, origin latency, and regional users.

07Sources

  1. CDNMDN Web Docs · Official technical documentationCDN
  2. HTTP Caching (RFC 9111)RFC Editor · Internet StandardHTTP Caching (RFC 9111)
View saved topics

Start typing to search titles, definitions, categories, and frameworks.