Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

How to validate if dispatcher is caching aem content - AEMaaCS

Avatar

Level 9

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?

11 Replies

Avatar

Community Advisor

Hi @Mario248 
Can you check if there is a Last-modified Response header, which could hint the content generation/cache time

Last-modified: Fri, 06 Sep 2024 11:20:02 GMT
 
Another way to test dispatcher config in local using AEM SDK and Dispatcher : https://medium.com/@arunpatidar26/aemaacs-setup-guide-71e6f5d206ff 


Arun Patidar

Avatar

Level 9

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.

Avatar

Community Advisor

@Mario248 ,

 

You can check the X-Cache header to see if the request is HIT or MISS for a given URL request.

 

Sudheer_Sundalam_1-1725892518173.png

 

 

 

Avatar

Level 9

I think this X-Cache is set by Fastly not dispatcher. FYI, I am not using Fastly CDN

Avatar

Community Advisor

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.

Avatar

Community Advisor

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-

  • Access a page
  • Made some changes in author, publish it, re-access the same previous page it should not show updated content (if dispatcher  flush agent is not set on page publish)
  • Access the same page with any query param(appending some query like /pagePath?q=somethingrandome) it should display page with updated content(as in general query params are not cached, even if query params get cached you may try with different query param value each time).

Thanks

 

Avatar

Level 5

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. 

 

sarav_prakash_0-1725931253054.png

 

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

sarav_prakash_1-1725931536045.png

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.

 

Avatar

Level 9

I think this X-Cache is set by Fastly not dispatcher. 

Avatar

Employee

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

Avatar

Administrator

@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!



Kautuk Sahni

Avatar

Level 4

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.

Screenshot 2024-09-25 at 19.13.15.png

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