CDN integration
Purpose: Put a CDN in front of the dispatcher correctly: TTLs, invalidation strategy, and header hygiene.
Who this page is for
| Audience | Why it matters to you |
|---|---|
| Platform engineers | Config owners |
| All engineers | Understanding the full cache chain |
The cache chain
Browser cache ── CDN edge ── Dispatcher docroot ── Publish render
(short) (TTL) (event-invalidated) (truth)
Two different consistency models meet here: the dispatcher invalidates on publish events; the CDN typically expires by TTL. Design both deliberately or authors will ask why content "half-updated".
Standard strategy
| Content | Dispatcher | CDN TTL | Browser |
|---|---|---|---|
| HTML pages | Event-invalidated | Short (1–5 min) | no-store/short |
| Versioned clientlibs | Cached | Long (months) — hash-busted | Long |
| DAM assets | Event-invalidated | Medium (hours) | Medium |
| .model.json consumed by apps | Event-invalidated | Short | Short |
Short HTML TTL at the CDN gives you edge offload while capping staleness after publish. Teams needing instant consistency add CDN purge on publish (a replication-triggered purge call) — an integration you own, with all its failure modes; only build it when short TTLs genuinely aren't enough.
Header hygiene
- Publish/dispatcher must emit correct
Cache-Control(via dispatcher /headers + web-server config); CDNs obey origin headers unless overridden. - Strip cookies on cacheable paths — a Set-Cookie on HTML at the CDN typically disables caching or, worse, caches one user's cookie.
- Normalise query strings at the CDN (whitelist known params) to match dispatcher /ignoreUrlParams — mismatched behaviour between the layers causes ghost misses.
- Forward the correct Host header; virtualhosts in the farm must match what the CDN sends.
Debugging order
Response headers tell you who served it (CDN cache status headers, Age). Reproduce against: CDN URL → dispatcher directly → publish directly. The first layer where the response is correct tells you which cache is stale.