Skip to content

CDN

Entry #228 / 700 · Chapter 5 · 5.2 Speed, rendering and modern front-ends
In one sentence

A network of servers distributed geographically, serving cached copies from the location nearest the visitor.

Analogy Mental model

Regional warehouses. An order from Beijing ships from Beijing, not from headquarters.

In practice What you actually do

Cache static assets aggressively with content-hashed filenames, and cache HTML for a short window with a purge on publish. Configure the origin so the CDN absorbs traffic spikes that would otherwise reach the application.

Where people get burned Pitfalls

Cache rules copied between projects cause the worst failures: personalised pages served to the wrong visitor, or stale HTML after a publish. Test with a purge before assuming the CDN is innocent.

This entry was written in English from the Chinese original, not machine-translated. Read the Chinese version →