A CDN (Content Delivery Network) is a set of edge servers (POPs) close to users. It caches static assets (and often API responses) at the edge so requests are served from a nearby node instead of the origin, reducing latency and load on the origin.
| Content type | Typical use |
|---|---|
| Static assets | JS, CSS, images, fonts — long TTL |
| API responses | Cacheable GET with Cache-Control; short TTL or key by user |
| Whole pages | Static or ISR pages |
Origin sends Cache-Control: public, max-age=3600 (and optionally s-maxage for shared/CDN). Edge caches and serves for that period; after expiry it revalidates with origin (or serves stale while revalidating).
Use a CDN for static content and for cacheable API responses when low latency and offloading origin matter. Invalidate or use short TTL when content must stay fresh.