In one line: a CDN caches static assets at hundreds of edge points of presence worldwide; users hit the nearest one. The origin only sees cache-miss "fill" traffic, capacity grows by orders of magnitude, and intercontinental access drops from seconds to milliseconds.
What it is#
User → nearest edge PoP
cache hit → return immediately
cache miss → pull from origin → cache → return
DNS routes the user to "the nearest edge IP" via Anycast + GeoDNS.
Analogy#
The origin is a central warehouse; CDN edges are convenience stores everywhere. Hot products (cache hits) you buy at the corner store; cold ones (misses) the store fetches from the warehouse for you and stocks the shelf for next time.
Key concepts#
How it works#
The origin only sees N misses while the system absorbs hundreds-to-thousands × the request volume.
Practical notes#
-
Set Cache-Control correctly:
Cache-Control: public, max-age=31536000, immutable # static assets Cache-Control: no-store # user-private data Cache-Control: public, max-age=60, s-maxage=600 # pages: browser 1m, CDN 10m -
Use versioned filenames (
/app.abc123.js): a new release just bumps the hash and the CDN naturally rotates. -
Don't overuse
Vary:Vary: Cookieshards the cache per-cookie — hit rate collapses. -
Run HTTPS end-to-end: set origin to HTTPS too; avoid "Flexible SSL"-style cleartext-to-origin modes.
-
Edge compute: Cloudflare Workers / AWS Lambda@Edge can mutate requests/responses without going back to origin.
Easy confusions#
Mostly caching + acceleration + DDoS absorption.
Routing / auth / canary / TLS termination.