Web and CDN Caching

Every time a web page loads instantly on a repeat visit, or a video streams smoothly from halfway around the world, caching is the reason. The web is layered with caches — in your browser, at CDN edge servers near you, in front of origin servers — all applying the same caching principle to make the internet fast. And remarkably, much of it is coordinated by a few HTTP headers that let servers tell caches exactly what to store and for how long. Understanding web and CDN caching is understanding how the internet stays fast at global scale.

Web caching and CDNs (Content Delivery Networks) apply caching across the internet to make the web fast. This post covers HTTP caching (how caches are controlled by headers), the browser cache, CDNs (caching content near users at the edge), and how these layers work together. It’s caching applied to the web — the same principles (from earlier posts) at internet scale, coordinated by HTTP. This is caching most engineers interact with constantly.

HTTP caching and cache headers

The web has built-in caching coordinated by HTTP headers — the servers tell caches what to store and for how long, making web caching standardized and controllable:

HTTP caching is built into the protocol, coordinated by headers — Cache-Control (cacheable? how long? — a TTL) and validation via ETags/conditional requests (cheaply check if a cached copy is still current) — letting servers control exactly how responses are cached. This standardized, header-driven caching is what makes web caching work across the internet’s many caches. The nearest cache to the user is the browser.

The browser cache

The browser cache — caching in the user’s own browser — is the closest, first layer of web caching:

The browser cache — local caching in the user’s browser, controlled by HTTP headers — is the closest and fastest web cache layer, serving repeat requests locally without any network fetch (why revisited pages load fast). It’s the first layer; beyond it, CDNs cache content globally near users.

CDNs: caching at the edge

A CDN (Content Delivery Network) caches content on servers distributed around the world (“the edge”), close to users — a powerful application of caching at global scale:

CDNs cache content on globally-distributed edge servers close to users — serving from a nearby edge instead of the distant origin, reducing latency (distance-driven) and offloading the origin — making the web fast globally and scalable. A CDN is the caching principle applied at internet scale, geographically. Browser, CDN, and origin caches form layers.

Layers of web caching

Web caching works as multiple layers — browser, CDN, and origin-side caches — that together make the web fast, a nice illustration of caching’s universality:

   Web request flow through cache layers:
     Browser cache → CDN edge cache → origin-side cache → Origin (source)
     (on device)     (nearby edge)    (reverse proxy/     (only if all
                                       app cache/Redis)     caches miss)
   each layer serves what it has; misses fall through to the next

Web and CDN caching apply the caching principle across the internet — HTTP headers coordinate it, the browser cache serves repeat requests locally (fastest), CDNs cache content on global edge servers near users (fast, scalable), and browser/CDN/origin caches layer to absorb most requests and spare the origin. It’s caching at internet scale, layered — the same universal principle from the user’s device to the source. Next, the final post: caching pitfalls and practice.

Key takeaways

Further reading

Sources & References

HTTP and browser caching