I am using an AEM Cloud instance and have completed all the necessary dispatcher configurations. Now, I want to verify if the dispatcher is caching AEM content. In an on-prem setup, we typically check the doc root to confirm if the content and JS files are cached. How can I validate this in AEM Cloud? Is there a specific header that indicates the content is served from the dispatcher cache?
Views
Replies
Total Likes
Hi @Mario248
Can you check if there is a Last-modified Response header, which could hint the content generation/cache time
Thanks for your response. I can see "last-modified: Mon, 09 Sep 2024 10:15:22 GMT" but it is showing my current day but actual published date is 13 Aug 2024 as per publish instance. I dont think "last-modified" will be helpful.
You can check the X-Cache header to see if the request is HIT or MISS for a given URL request.
I think this X-Cache is set by Fastly not dispatcher. FYI, I am not using Fastly CDN
I dont think there is any specific header which will indicate whether it is served from dispatcher or not.
But you can essentially verify that from the dispatcher_httpderror logs which you can download from cloud manager.
Hope this helps.
Hi @Mario248 ,
One approach can be what ever the max age and other header we are setting in dispatcher rule, those should reflect in network section of browser.
Other naive approach which might be used to test is-
Thanks
Hi @Mario248 ,
Open the network tab and on initial document request, inspect the response headers.
Look for a `X-Cache`. If the value is `HIT`, it means its served from dispatcher cache. If its `MISS`, then no dispatcher cache, it going to publisher and page is served by publisher.
This works assuming NO CDN and standard dispatcher configuration. Generally each organization customize the response headers, per requirement, or CDN might change response headers like this
Differs for each website. But look for a response header that says "HIT" or "MISS" and that ll tell cache status.
To brute force validate this, once you confirm a "HIT", republish the page. This will clear the cache. The second request must be "MISS". And third request must be "HIT" again. This will confirm your dispatcher cache is working clean.
I think this X-Cache is set by Fastly not dispatcher.
Views
Replies
Total Likes
On AEM as a cloud, I would access a cacheable resource like .jpg and observe the log. I track the request starting from CDN log >>httpd Log (Dispatcher level) >>AEM request.log. If CDN is serving the request, you will not find an entry in the dispatcher log. If dispatcher is serving the cached response, then AEM's log will not* have an entry and so on.
*permission sensitive caching is an exception where you will find AuthCheckerServlet's entry in AEM's log for every secured-cached resource served from dispatcher
@Mario248 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Hi @Mario248,
the only way I am aware of how to check if Dispatcher served cached content of not is to check the aemdispatcher log. You can download the log file from Cloud Manager or in case you use Splunk you can query the log.
The X-Cache header is set by the CDN on AEMaaCS, not by Dispatcher. Actually, it would be quite helpful if we had some debug headers for Dispatcher, but we don't.
Hope this helps,
Daniel
Views
Replies
Total Likes