What is a CDN?
Useful first: Caching · optional, not a requirement
Choose your depth
Stay with the essentials, or look closer.
YOUR GOALDistinguish the website's origin from the CDN locations that help deliver its content.
Deliver a useful copy closer to the reader.
The source and the delivery network
A website's origin supplies its content. A content delivery network, or CDN, has servers in many locations that can deliver that content to visitors. These delivery locations are often called the edge.
Imagine a photo guide whose origin is far from a reader. A CDN can keep a reusable copy of a public photo at an edge location, reducing the need to fetch it from that distant origin each time.
[1]Help with delivery, not a complete replacement
The origin still matters when the CDN needs content it cannot serve from a stored copy. A CDN does not automatically replace the application's account logic or source files.
A useful edge location depends on network conditions and routing, not just distance on a map. A CDN can improve delivery without making every request faster.
[1] [2]The origin supplies content; the CDN provides distributed places to deliver it.
Putting a CDN in front of a website means the origin is no longer needed.
Requests that cannot be satisfied at the edge may still need the origin.
Show the explanation
Deliver the photo without fetching its body from the origin for that request. A reusable edge copy can avoid that origin fetch. It does not replace application logic or guarantee a particular route.
YOUR GOALExplain cache hits, misses, and why a stored response is not always reusable.
Follow a request through the cache.
A miss can still produce a successful response
Suppose the selected edge has no cached copy of /photos/harbor.jpg. That is a cache miss, not necessarily a broken page. The CDN requests the content upstream, receives the response, and passes it to the visitor. It may store a copy if caching rules allow.
A later request can be a cache hit when a suitable stored response is available. Larger CDN designs may consult another cache tier before the origin.
[2]Freshness is permission to reuse
A stored response has an age and may have a freshness lifetime. For an otherwise reusable public response, Cache-Control: max-age=300 sets a five-minute freshness lifetime. A matching response with an age of two minutes is still fresh under that rule.
This does not prove the origin has not changed. Once stale, the response may need validation or replacement; serving stale content requires permission under the applicable rules.
[3]Not every response belongs in the edge cache
The CDN's configuration and the response's caching rules determine eligibility. For example, Cloudflare's default CDN behavior does not cache HTML or JSON; an operator can configure different behavior. That is a provider default, not a rule that HTML can never be cached.
A public stylesheet and a signed-in account page need different decisions, even when both pass through the same delivery network.
[7] [5]A miss can fetch upstream successfully; a hit is useful only when the stored response is eligible for reuse.
A cache miss means the visitor receives an error.
The CDN can fetch the requested content upstream and return a successful response.
Show the explanation
Fetch the image upstream and deliver it, potentially keeping a copy. An empty cache is a reason to retrieve content, not proof that the content is unavailable.
YOUR GOALReason about cache keys, personalized content, and releasing changed assets.
Cache the right response, not merely a fast response.
The key decides which requests share a copy
A cache key identifies which stored response a request can match. Suppose an image service returns different sizes for /cover.jpg?width=320 and /cover.jpg?width=1280. If a custom key ignores width, both requests can collide and receive the wrong size.
Cloudflare includes the query string in its default key, but custom rules can change this. Keep response-changing inputs represented in the caching strategy; a higher hit rate is not useful if it serves the wrong content.
[4]Shared storage needs explicit boundaries
A CDN cache can serve many visitors. A personalized response marked Cache-Control: private must not be stored by a standards-compliant shared cache, though a browser's private cache may store it. On its own, Cache-Control: no-store prohibits storage by both kinds of HTTP cache.
A cookie alone is not a universal guarantee against shared caching. Review CDN overrides and personalized routes: for example, one reader's saved notes must not become another reader's cached page.
[3] [5]Change the asset's address or invalidate its copy
For static assets, publishing /assets/diagram.v2.svg and updating the page to reference it creates a different URL from /assets/diagram.v1.svg. Keep each version's content stable so long-lived copies remain useful.
If a URL must stay the same, a CDN's purge or invalidation operation can remove its managed cached copy. That does not erase copies already stored in visitors' browsers. The HTML that selects the asset also needs an appropriate update strategy.
[5] [6]Correct cache keys, privacy rules, and update strategies make edge reuse safe and useful.
Purging a CDN instantly clears every browser's cache too.
A CDN purge targets the CDN's managed cache; browser copies are separate.
Show the explanation
They can share an entry and receive the wrong image size. Ignoring an input that changes the response can merge variants that should remain distinct.
Keep asking. Check the details.
Source-checked using AI (OpenAI Codex) on . The checks covered sources, examples, and quizzes for this article version.
No human review is claimed. AI review can miss errors; check the original sources below.
- Cloudflare Learning Center — What is a CDN?
- AWS — How CloudFront delivers content
- RFC 9111 — HTTP caching, freshness, and storage rules
- Cloudflare — Cache keys
- MDN — HTTP caching and cache busting
- AWS — Invalidation and versioned file names
- Cloudflare — Default cache behavior