# Content Delivery Network \(CDN\)

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

- Type: term
- Domain: Engineering & architecture
- Level: Foundational
- Last reviewed: 2026-09-23
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/content-delivery-network/>)

## What 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.

## Why 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.

## When 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.

## How 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.

## A practical 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.

## Where 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.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/content-delivery-network/#visualization-content-delivery-network>)

## Sources

1. [CDN](<https://developer.mozilla.org/en-US/docs/Glossary/CDN>) — MDN Web Docs · Official technical documentation
2. [HTTP Caching \(RFC 9111\)](<https://www.rfc-editor.org/rfc/rfc9111>) — RFC Editor · Internet Standard

## Related topics

- [Cache](<https://wiki.soroush.uk/topic/cache/>)
- [HTTP](<https://wiki.soroush.uk/topic/http/>)
- [Non-Functional Requirements](<https://wiki.soroush.uk/topic/non-functional-requirements/>)
