Day 37 of 40
Dispatcher Config and Caching
Cache rules, TTLs, invalidation and purging the CDN
By the end of today you should be able to
- Navigate the Cloud Service dispatcher configuration structure
- Set cache TTLs using Cache-Control headers
- Explain how CDN, Dispatcher and browser caching layer together
- Purge the CDN cache and know when it is warranted
The layers
A request passes through several caches, each with its own rules. Knowing which one is serving stale content is most of debugging:
- Browser cache — governed by
Cache-Controlon the response. - CDN — Adobe's managed CDN, also governed by
Cache-Control, with its own purge API. - Dispatcher — file cache on disk, invalidated by
.statfiles on publish. - AEM — renders, and has its own internal caches.
Work inwards. Request with cache-busting query to skip the browser; check response headers for age and cache status to see whether the CDN served it; look at the Dispatcher docroot on disk; then check AEM itself. Guessing which layer is at fault wastes far more time than checking in order.
The Cloud Service dispatcher structure
Your project's dispatcher/src follows a prescribed, validated layout:
dispatcher/src/
conf.d/
available_vhosts/ # virtual host definitions
enabled_vhosts/ # symlinks to the ones in use
rewrites/ # rewrite rules
variables/
conf.dispatcher.d/
available_farms/ # farm definitions
enabled_farms/ # symlinks to the ones in use
cache/ # cache rules and TTL settings
filters/ # the security filters
clientheaders/
renders/
virtualhosts/
The available_ / enabled_ pairing lets you keep configuration in the repository
without activating it. Files under enabled_ are symlinks — a real detail that catches people
out on Windows.
Adobe owns some of these files and you own others. The update_maven script refreshes
Adobe's baseline when they revise it, which is why keeping your customisations in the designated
custom files matters.
TTLs
On Cloud Service, cache lifetime is driven by Cache-Control headers rather than solely by
Dispatcher configuration. You set them per content type:
<LocationMatch "^/content/.*\.html$">
Header set Cache-Control "max-age=300,stale-while-revalidate=60"
</LocationMatch>
<LocationMatch "^/etc\.clientlibs/.*">
Header set Cache-Control "max-age=31536000,immutable"
</LocationMatch>
Reasonable defaults:
- Versioned clientlibs and assets — very long (a year),
immutable. The URL changes when the content does, so it is safe. - HTML pages — short, minutes. Long enough to absorb traffic spikes, short enough that publishing feels responsive.
- Personalised or authenticated responses —
privateorno-store. Never let a shared cache hold them.
stale-while-revalidate is worth knowing: the cache serves slightly stale content while
fetching a fresh copy in the background, so a visitor never waits for a revalidation.
Invalidation and purging
- Dispatcher — publishing triggers a flush, which touches
.statfiles (day 6). This is automatic. - CDN — not automatically purged by publishing. Content ages out by TTL, or you purge explicitly.
Adobe provides a purge API for the CDN, configured through a config pipeline. Use it for genuine urgency — a legal correction, a wrong price, an incident. It is not a substitute for sensible TTLs: purging routinely means your TTLs are wrong.
This surprises people regularly. A page republished on AEM can still be served from the CDN until its TTL expires. If publishing must be visible immediately, the HTML TTL has to be short — or the workflow has to include a purge.
Migrating an existing Dispatcher config
Moving from AMS or on-premise, an existing configuration will not transfer as-is: Cloud Service
prescribes the structure and validates it. Adobe's Dispatcher Converter (part of the
modernisation tooling, day 40) transforms a legacy configuration into the Cloud Service shape, which
you then review and validate with bin/validate.sh.
Four cache layers; debug inwards. TTLs come from Cache-Control — long for versioned assets, short for HTML, never for personalised responses. Publishing flushes the Dispatcher but not the CDN.
Watch
Adobe's own videos for this topic. They load only when you press play.
Read on Experience League
The primary sources these notes are drawn from.
Your notes
Saved automatically to this browser.
Check yourself
10 questions on today's material. 80% to pass.