How to validate if dispatcher is caching aem content - AEMaaCS | Community
Skip to main content
Mario248
Level 7
September 9, 2024

How to validate if dispatcher is caching aem content - AEMaaCS

  • September 9, 2024
  • 8 replies
  • 3107 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

8 replies

arunpatidar
Community Advisor
Community Advisor
September 9, 2024

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
Mario248
Mario248Author
Level 7
September 9, 2024

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.

Sudheer_Sundalam
Community Advisor
Community Advisor
September 9, 2024

@mario248 ,

 

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

 

 

 

 

Mario248
Mario248Author
Level 7
September 9, 2024

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

h_kataria
Community Advisor
Community Advisor
September 9, 2024

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.

MukeshYadav_
Community Advisor
Community Advisor
September 9, 2024

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

 

sarav_prakash
Community Advisor
Community Advisor
September 10, 2024

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.

 

Mario248
Mario248Author
Level 7
September 23, 2024

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

Adobe Employee
September 11, 2024

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

kautuk_sahni
Community Manager
Community Manager
September 13, 2024

@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
daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 25, 2024

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