What a CDN is
A content delivery network is a fleet of edge servers spread worldwide that cache content near users, cutting latency and origin load.
- Static content like images and scripts caches well because it rarely changes.
- These are stored with long lived cache rules at the edge.
- Dynamic content changes per user but can still benefit from short edge caching or routing acceleration.
How a request is served
The nearest edge answers from cache if it can; otherwise it fetches from origin and stores the result.
Static versus dynamic at the edge
- For static, set long max age and use versioned filenames so updates bust caches cleanly.
- For dynamic, cache short lived responses or use the CDN only to accelerate the path to origin.
- Edge compute can personalize responses without a full origin round trip.
Practical notes
- Use cache keys that include only fields that change the response.
- Purge or version assets on deploy to avoid stale content.
- Keep origin shielded so the CDN absorbs traffic spikes.
Key idea
A CDN caches static content aggressively and accelerates dynamic content, moving work to the edge to lower latency and protect the origin.