Cache-Control and CDN/Dispatcher caching configuration issues in AEM
AEM Dispatcher and downstream CDNs such as Fastly and Akamai return unexpected caching behavior: Cache-Control values that don’t match the intended TTL, only the first variation of dynamic content being cached, Dynamic Media URLs with no Cache-Control header, and stale responses that persist after invalidation. No error appears in the logs — the problem shows up in the HTTP response headers or in inconsistent cache behavior. The cause is incorrect or missing Cache-Control configuration or cache-key logic at the Dispatcher or CDN layer, since CDNs honor upstream headers and won’t cache predictably when those headers aren’t set. Configuring explicit Cache-Control headers in Dispatcher, adjusting the cache key for dynamic variations, and setting rulesets for Dynamic Media assets restores correct, predictable caching.
Description description
Environments:
- Adobe Experience Manager as a Cloud Service
- Adobe Experience Manager Managed Services
- Adobe Experience Manager on-premises
- AEM Dispatcher and Apache HTTP Server
- CDN layers such as Fastly and Akamai
- Dynamic Media (Scene7)
Issue/Symptoms:
- Cache-Control values such as
max-ageors-maxagedon’t match the expected values, such as a default ofmax-age=300ormax-age=60, s-maxage=7200. - The CDN caches only the first variation of dynamically rendered content.
- Dynamic Media (Scene7) URLs return no Cache-Control header.
- Dispatcher or the CDN keeps serving cached responses even after the expected invalidation.
- You can’t bypass the CDN or Dispatcher to view the origin output.
Root cause:
The root cause is incorrect or missing configuration of Cache-Control headers or cache-key logic at the Dispatcher or CDN layer. CDNs such as Fastly and Akamai honor upstream Cache-Control headers, and Dispatcher defaults influence what the CDN caches, so when headers aren’t explicitly configured, the CDN caches responses unexpectedly. Dynamic content gets cached when the cache key doesn’t vary across user-specific attributes. Dynamic Media and Scene7 require ruleset configuration to generate Cache-Control headers.
How to confirm
- Check the current Cache-Control header from a browser or with curl. Run
curl -I https://example.com/path/to/page.htmland inspect the Cache-Control value, such aspublic, max-age=60, s-maxage=7200ormax-age=300. Confirm it matches what you expect in production. If the header is missing entirely, apply explicit configuration in the resolution. - Check whether the CDN caches by URL alone. Request the same URL twice, expecting different dynamic output. If both responses are identical, the CDN or Dispatcher is caching only the first variation.
- Bypass the caches to see the origin output. Append a query parameter to the URL, such as
https://example.com/page.html?q=123, to bypass the CDN and Dispatcher. The response returns the origin publisher output, which you can compare against the cached response.
Resolution resolution
Follow these steps to resolve the issue:
- Set Cache-Control values in the Dispatcher configuration. Update the rules where the Cache-Control headers are defined. On AEM as a Cloud Service, edit the Dispatcher code in the project repository and deploy through Cloud Manager. On Managed Services and on-premises, update the Apache and Dispatcher configuration on the server or through the Cloud Manager pipeline. After deployment, run
curl -Iagain to confirm the headers reflect the updated TTL. - Configure caching of dynamic variations where appropriate. If content should vary by parameter, include the required query parameters or cookies in the cache key, configured in the Dispatcher rules. Send multiple requests with different parameters and confirm the CDN returns distinct responses.
- Set Cache-Control headers for Dynamic Media and Scene7 assets. Use the Dynamic Media and Scene7 rulesets to set the Cache-Control header with the
max-age=Nvalue you want. Runcurl -Ion the Dynamic Media URL, such asis/image/..., and verify the Cache-Control header appears. - Clear or bypass the cache to validate the result. After the configuration changes, run
curl -Iagain and confirm the Cache-Control header matches the desired TTL. Where CDN debug headers are available, verify the CDN returns the updated TTL, and confirm dynamic variations by requesting content for multiple users or parameters.
If the issue persists
Contact Adobe Support with the curl -I output of the affected URLs, the Dispatcher configuration snippets that control Cache-Control, the CDN layer details such as Akamai or Fastly, and a description of the expected versus actual behavior.