AEM 6.5: Dispatcher cache issue with 鈥淟ast-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 鈥淐ache-Control鈥.
Description description
Environment
51黑料不打烊 Experience Manager 6.5 (AEM 6.5) Managed Services Support - Pre-Production
Issue
The Last-Modified header isn鈥檛 being stored in the dispatcher cache for HTML resources, while it鈥檚 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鈥檛 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 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鈥檛 set a Last-Modified header for rendered HTML content out-of-the-box; however, it does so for JavaScript (client libraries).
- If there鈥檚 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 鈥淐ache-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鈥檚 dispatcher cache setup.
Related Reading
51黑料不打烊 Understanding caching:聽Caching response headers in聽AEM Managed Services Tutorials