A CDN takes over serving static files such as images, video, styles and scripts: instead of a single server, the nearest node in the network answers the user. This speeds up the site and removes most requests and traffic from the main server.
How it works
| Element | Role |
|---|---|
| Origin | the site’s main server, which the CDN contacts for files |
| Edge | a CDN server in the user’s city or country; holds copies of popular files |
| TTL | how long a copy lives on the edge; set by the origin with a header such as Cache-Control: max-age=600 |
This usually works on a pull model: on the first request, the edge fetches the file from the origin, serves it to the user and keeps it until the TTL expires. To refresh a file earlier, you use invalidation, a separate operation in the CDN control panel.
- Static content is the CDN’s main job: images, video, styles, scripts, fonts.
- Personalised responses are not cached by default: if cookies end up in the cache key, each user gets their own copy of the object.
What it gives you
- Speed: the response comes from an edge in the user’s own region rather than from a server on another continent.
- Origin offload: most requests never reach the main server, so it can be smaller and cheaper.
- Resilience: a DDoS attack hits a distributed network of nodes rather than a single server, and is filtered along the way.
- Connections: the nearest node handles the TLS handshake and HTTP/2 and HTTP/3 requests, while data travels to the origin over the CDN’s network.
Users are directed to the “nearest” node by DNS: for example, Amazon CloudFront picks the node that can serve the request best, usually the one with the lowest latency. Other networks use anycast: one address is announced from many points in the network, and routing itself brings the user to the closest node.
Sources
the term is written from these pages- Cloudflare — What is a CDN?cloudflare.com/learning/cdn/what-is-a-cdn/(opens in a new tab)
- RFC 9111 — HTTP Cachingrfc-editor.org/rfc/rfc9111.html(opens in a new tab)
- Amazon CloudFront Developer Guide — How CloudFront delivers content to your usersdocs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/HowCloudFrontWorks.html(opens in a new tab)
Verified 9 Nov