CDN (Content Delivery Network)
A globally distributed cache that serves static (and sometimes dynamic) content from edge locations close to users. Reduces origin load and request latency.
A CDN (Content Delivery Network) is a global network of cache servers (edges) that serve content to users from the nearest geographic location instead of forcing every request back to a central origin server. The goal is two-fold: lower latency for users, lower load on the origin.
Cloudflare, Fastly, Akamai, Amazon CloudFront, Vercel/Netlify edge, Cloudflare's R2-backed edges all fall under "CDN."
What it speeds up
- Static assets. Images, CSS, JS, fonts, video. The classic CDN use case. A 200ms TTFB to a US origin becomes a 20ms TTFB to a London edge for a London user.
- Cached HTML. If your pages are cache-friendly (most marketing pages, blog posts, docs), the CDN serves the HTML too, not just the JS bundle.
- Dynamic content with smart caching. Edge SWR (stale-while-revalidate), tag-based invalidation, edge personalization (decide cache key from cookie or geo without involving origin).
What it doesn't speed up
- Truly dynamic per-user pages that can't be cached. You can edge-route them (cut TCP/TLS handshake to the edge) but the origin still does the work, and the request still has to hop from edge to origin.
- Database queries. CDNs cache HTTP responses, not query results. If your latency budget is dominated by a slow query, the CDN won't help.
- Writes. POST/PUT requests bypass the cache and go to origin.
How DNS, custom domains, and CDNs interact
CDN-fronted sites use DNS to point user requests at the CDN's edge IPs. Two ways:
- Apex (
example.com). Use ALIAS, ANAME, or a flattened CNAME to point at the CDN's edge hostname. Or use the CDN's "use my apex" feature if they're also your DNS host. - Subdomain (
www.example.com,assets.example.com). Standard CNAME pointing at the CDN's edge hostname.
The CDN then receives the request, terminates TLS using the cert for the customer's hostname (issued automatically), and either serves from cache or forwards to origin.
For a custom-domain SaaS
Customers point their domain at your platform; your platform may itself sit behind a CDN (or be a CDN). Either way, the path from customer's user to your app is:
user → DNS (resolves customer.com) → CDN edge → your app's origin
Each hop adds latency unless caching kicks in at the edge. Most SaaS custom-domain platforms put a CDN/edge layer in front and cache aggressively to keep the user-perceived latency low for static parts and to absorb DDoS / surge traffic before it hits the origin.
When you don't need a CDN
- Internal-only apps with users in one office.
- B2B platforms where every page is per-user dynamic and uncacheable.
- Latency-insensitive workloads (batch processing UIs, admin dashboards).
For everyone else, a CDN is cheap and the gain is real.