AEM 6.5: Dispatcher cache issue with “Last-Modified” header
To get consistent caching of the Last-Modified across all resource types, either implement custom logic within your page-rendering process to manually set the header, or use dispatcher configurations to directly manage caching through headers like “Cache-Control”.
Description
Environment
Adobe Experience Manager 6.5 (AEM 6.5) Managed Services Support - Pre-Production
Issue
The Last-Modified header isn’t being stored in the dispatcher cache for HTML resources, while it’s correctly stored for JavaScript files. This discrepancy occurs despite having the property set at both the Author and Publish levels.
For HTML pages, like /content/*/*.html
, the Last-Modified header doesn’t appear in the cached file.
For JavaScript files, like /etc.clientlibs/clientlibs/granite/jquery.min.js
, the Last-Modified header is present and correctly stored.
Resolution
To have consistent caching of the Last-Modified header across all resource types, use these methods to resolve the issue:
- Understand that by default, AEM doesn’t set a Last-Modified header for rendered HTML content out-of-the-box; however, it does so for JavaScript (client libraries).
- If there’s a requirement to include a Last-Modified header for HTML or other specific purposes. Implement custom logic within your page-rendering process to manually set this header.
- Consider alternative approaches if leveraging headers primarily for caching control. Use dispatcher configurations to directly manage caching through headers like “Cache-Control”. This can provide effective cache management without relying solely on the presence of a Last-Modified header.
By following these steps, you can ensure more consistent handling of HTTP headers across different resource types within your AEM environment’s dispatcher cache setup.
Related Reading
Adobe Understanding caching: Caching response headers in AEM Managed Services Tutorials