concept Delivery & performance
CDN
Understand how a CDN serves nearby edge responses, when it contacts origin, and why not all content is cached.
What it means
A CDN distributes delivery through edge locations that may cache or proxy content closer to requesters. Whether a particular response is served from cache depends on cache rules, request/response headers and existing edge state. A CDN cannot make every origin failure disappear, and one successful edge response is not a global freshness guarantee. HTTP caching Provider cache rules
A nearby edge can reduce repeated long-distance transfers for cacheable content, but there is no universal speed guarantee: a miss still needs origin work, and connection and application costs remain.
Try it
Simulation — compare two independent edge caches. Request a public resource at edge A, repeat it, change the origin version or choose edge B. The result shows HIT, MISS or BYPASS together with the specific edge's stored version and lifetime.
Explore two edge caches
Request the same public object from two independent edges, then change its origin version.
Virtual time 0 s; origin v1. Eligibility and freshness are separate from the existence of a network edge.
| Item | State / result | Why it matters |
|---|---|---|
| Edge A: /guide | Empty | First eligible request must contact origin. |
| Edge B: /guide | Empty | First eligible request must contact origin. |
No CDN API, network, geographic latency or provider performance prediction.
About this model
A cache key is edge plus /guide; /account is explicitly private and bypasses storage. Freshness uses the TTL at fill time. Origin updates do not invalidate fresh edge copies. Purging affects only the selected edge and exact /guide key. Revalidation and stale-on-error are intentionally omitted.
Read the article’s primary sources for protocol rules and implementation-specific limits. This scene has no network access.
The first public request at A fetches origin v1; a repeat before expiry reuses A's saved v1. Change the origin to v2 and repeat at A: a fresh cached v1 can still be eligible. A first request at B can fetch v2 because B has no saved copy. Those different versions are not evidence that the origin edit failed.
| Sequence | Edge A | Edge B or origin |
|---|---|---|
| First public request at A | MISS; store v1 | Origin v1 supplies the response |
| Repeat at A before expiry | HIT; reuse v1 | No new origin response in this fixture |
| Origin changes to v2 | A's fresh v1 is unchanged | Origin now has v2 |
| First public request at B | A is unaffected | B misses and obtains v2 |
| Private account resource | BYPASS; no shared storage | A request still depends on the origin |
Advance to the exact expiry boundary or purge the selected edge's exact /guide key, then request again. A purge of the wrong key stops; a purge at B does not silently remove A. TTL zero prevents reuse in this fixture. The TTL control affects subsequent fills, not a lifetime already saved.
Reset removes both synthetic caches, history and virtual time and restores origin v1. No CDN account or network is accessed. This model deliberately excludes multi-tier caches, revalidation, routing decisions and provider-specific purge propagation. Its private-response bypass is a declared shared-cache safety rule, not a claim that every provider's default configuration is identical. HTTP cache controls One provider's documented defaults
The origin is still part of the system
The origin remains authoritative for content, unless an intentionally designed alternative supplies it. A cache miss, expired object requiring validation, uncached API call or certain errors can still contact origin. Revalidation may use an ETag or last-modified validator rather than downloading a full representation. Revalidation
A purge or invalidation request can remove/revalidate edge copies under the provider's rules, but does not guarantee that every browser cache or another intermediary discards its own copy. Likewise a CDN's cache hit does not prove that the origin currently works. Testing only a cached URL can mask an origin outage.
What to check when content looks old
- Compare the exact URL, method and relevant request headers. Two cache keys may refer to different responses.
- Inspect response
Cache-Control,Age,ETagand any documented edge cache-status fields. Provider-specific statuses should not be generalized to every CDN. - Establish whether the result came from browser cache, CDN edge, proxy or origin. Revalidate or invalidate at the layer that owns the stale copy, with approved production controls.
- For logged-in pages, confirm that private content is not unintentionally stored in a shared cache. A broad cache-everything rule can defeat an application's assumptions.
Fresh at the origin, old at the edge
Suppose an origin changes a CSS file at noon but an edge still holds a previously fresh response under its applicable lifetime. A visitor routed to that edge may receive the earlier bytes while another edge, with no reusable entry, fetches the new version. Updating the origin alone does not automatically revoke all stored copies. Conversely, a response with no reusable cache state may reach the origin for each eligible request, so placing it behind a CDN is not proof of a cache hit. Validation and explicit purge mechanisms are separate controls with provider-specific behavior. Cache freshness Revalidation
In practice
Identify the exact URL, method, response directives and relevant edge/cache headers for an authorized comparison. Record when and where responses were observed; distinguish cache hit, miss, revalidation and unknown rather than inferring geography from the result. Before a purge or policy change, establish its scope and effect on origin load; confirm both response freshness and application correctness afterward.
Key takeaways
A CDN can improve delivery only within its actual routing and cache constraints. Measure the response that a particular visitor received, and change caching deliberately rather than treating “CDN enabled” as a correctness or performance guarantee.
Frequently asked questions
Editorial questions, answered from the sources listed for this article.
Does changing an origin file immediately replace every edge copy?
Not necessarily. An eligible fresh edge response can remain reusable until its applicable freshness or invalidation rules require another origin interaction. Purge behavior is provider-specific, and a browser can have a separate cache.
Does every CDN cache HTML by default?
No. Defaults and cache eligibility depend on the provider, plan, configuration and response. Inspect the relevant policy rather than assuming all HTML is stored.
Can two edges return different versions?
Yes. Their stored responses and freshness state can differ at a given moment. Compare exact response and cache evidence.
Does a CDN purge also erase visitor browser caches?
Not generally. Edge storage and private browser caches are distinct. Their invalidation and validation rules may differ.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- RFC 9111 — HTTP Caching
Sections 3–5. Caching eligibility, validation, freshness and Cache-Control directives.
Checked .
- Cloudflare — Default Cache Behavior
Default cache behavior, edge TTL and request collapsing. Concrete CDN cache eligibility, origin fetch and variation by edge rules.
Checked .
- Cloudflare — Revalidation
Conditional requests and stale revalidation. CDN revalidation behavior is distinct from browser cache behavior.
Checked .