Glossary

What Is a CDN? Content Delivery Networks Explained

A Content Delivery Network (CDN) is a geographically distributed group of servers that cache content close to users. Instead of every visitor hitting your origin server, a CDN serves static assets (images, CSS, JavaScript) from the nearest edge node, dramatically reducing latency and load on your infrastructure.

How CDN Caching Works

When a user requests /image.png, the CDN checks its edge cache. On a cache miss, the CDN fetches the file from your origin server, stores it, and responds to the user. Future requests for the same file are served from the edge — typically in under 20 ms. Cache duration is controlled by Cache-Control headers (max-age, s-maxage) on your origin responses.

Beyond Static Files: Edge Compute

Modern CDNs (Cloudflare Workers, Vercel Edge Functions, Fastly Compute) run JavaScript or WebAssembly at the edge. This enables: A/B testing without round trips to origin, personalisation based on geolocation, request rewriting and authentication at the network edge, and real-time HTML manipulation — all with sub-millisecond added latency.

Cache Invalidation

Cache invalidation is hard. The safest strategy is cache-busting: include a content hash in file names (main.a3f9b2.js). When content changes, the filename changes, the CDN sees it as a new URL, and the cache is automatically bypassed. For documents or APIs, use a short max-age (60–300 seconds) or trigger a CDN purge via API when content updates.