On AEMaaCS we have released updated png logo under /etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/logo.png. This file is cached at the dispatcher level how would we flush the AEMaaCS cache for this particular file?
Other files includes
etc...
Thank you.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Check out this documentation about caching and invalidation. This might be a useful link.
Hi @SupportMember ,
To flush the cache for specific files like images (PNG, SVG, GIF) under /etc.clientlibs/ in AEM as a Cloud Service (AEMaaCS), you need to perform a few steps. This involves using the AEMaaCS API and dispatcher tools to invalidate the cache. Here's a step-by-step guide on how to achieve this:
Identify the paths of the files that need to be invalidated in the dispatcher cache. In your case, the files are:
AEM as a Cloud Service provides tools to manage the dispatcher cache. One of the key tools is the invalidate.cache API. You can use this API to invalidate specific paths.
You can use a POST request to invalidate the cache for the specific files. Here’s how to do it:
curl -X POST -u '<username>:<password>' \
-H "Content-Type: application/json" \
https://<aem-host>/dispatcher/invalidate.cache \
-d '{
"paths": [
"/etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/logo.png",
"/etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/logo.svg",
"/etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/icons/hammer.png",
"/etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/icons/spinner.gif"
]
}'
Replace <aem-host> with your AEMaaCS hostname and <username>:<password> with your credentials.
{
"paths": [
"/etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/logo.png",
"/etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/logo.svg",
"/etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/icons/hammer.png",
"/etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/icons/spinner.gif"
]
}
After invalidating the cache, ensure that the changes are reflected:
curl -I https://<aem-host>/etc.clientlibs/my-site/clientlibs/clientlib-site/resources/assets/logo.png
By following these steps, you can flush the cache for specific files in AEM as a Cloud Service, ensuring that updates to your resources are immediately reflected.
Thanks ChatGPT, I've been following you, and this is considered spamming, I am reporting you.
You should have a word with the administrators, this is getting out of hand. It's just very disrespectful to the community... You should really stop.. Spamming is not good, and also shows us that you are not a professional because anyone can use chat GPT to post questions on the query.
@kautuk_sahni @Jörg_Hoh , please be informed that spamming is on this Community at the moment.
@Jörg_Hoh @arunpatidar @aanchal-sikka @Rohan_Garg @Raja_Reddy , please if you can shed some experiences here, it would be extremely helpful, thank you.!
AEM Publish service has two primary caching layers, the AEMaaCS CDN and AEM Dispatcher. Assuming you don't have a custom CDN in front of the Cloud CDN, try the below steps-
Cache-Control
, Surrogate-Control
, or Expires
HTTP response headers. Refer CDN Cache Life<LocationMatch "^/etc\.clientlibs/.*\.(?i:json|png|gif|webp|jpe?g|svg)$">
Header set Cache-Control "max-age=43200,stale-while-revalidate=43200,stale-if-error=43200,public" "expr=%{REQUEST_STATUS} < 400"
Header set Age 0
</LocationMatch>
If however, you don't want to change/modify the TTLs in your dispatcher configuration then you can look at creating a custom servlet which purges cache from both Dispatcher and CDN. Please refer the blog Invalidate Dispatcher and Purge Fastly CDN Cache using API
How do you deploy this file? Via fullstack pipeline or frontend pipeline?
In case of the fullstack pipeline: Not a problem, as new instances will be started with an empty dispatcher cache. So you don't need to invalidate them.
Frontend pipeline: Good question, I am not an expert in that ... would need to learn to first how it is implemented internally
From my experience, you can do this in 2 ways.
1. New AEMaaCS Code Deployment, https://sourcedcode.com/blog/aem/how-to-clear-flush-aemaacs-cache-after-code-deployment?swcfpc=1
2. Adding dispatcher cache rules. I'd like to watch how the Adobe WKND project setup rules, and so we can see a rule here
<LocationMatch "^/etc\.clientlibs/.*\.(?i:json|png|gif|webp|jpe?g|svg)$">
Header set Cache-Control "max-age=43200,stale-while-revalidate=43200,stale-if-error=43200,public" "expr=%{REQUEST_STATUS} < 400"
Header set Age 0
</LocationMatch>
For #2, there a blog article written here about it, Serving New Client Library CSS and JS After Release on AEM as a Cloud Service (AEMaaCS),
Views
Likes
Replies
Views
Likes
Replies