need to modify header for clientlibs cache | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by MukeshYadav_

Hi @vishnu9 ,

You may use dispatcher Header set

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/caching#further-optimizations

 

Js/Css files for(12 hours)

<LocationMatch "^/etc\.clientlibs/.*\.(?i:js|css|ttf|woff2)$">
Header set Cache-Control "max-age=2592000,stale-while-revalidate=43200,stale-if-error=43200,public,immutable" "expr=%{REQUEST_STATUS} < 400"
Header set Age 0
</LocationMatch>

 

for 1 hour

 

Header set Cache-Control "max-age=3600,stale-while-revalidate=3600,stale-if-error=3600,public,immutable" "expr=%{REQUEST_STATUS} < 400"

 

Note:- Instead of refreshing whole clientlibs every hour you may create separate clientlib and write rules of 1 hour for that cleintlib only and for other clientlib you may keep 12 hrs 

 

Thanks

3 replies

kautuk_sahni
Employee
August 7, 2024

@vishnu9 Did you find the suggestions from users 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
EstebanBustamante
New Participant
August 6, 2024

Hi, 

You need to find where these headers are being set, this could be found in the dispatcher or CDN most frequently, once you find that configuration, you need to decrease the value to the one you need.


Hope this helps

Esteban Bustamante
MukeshYadav_
MukeshYadav_Accepted solution
New Participant
August 6, 2024

Hi @vishnu9 ,

You may use dispatcher Header set

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/caching#further-optimizations

 

Js/Css files for(12 hours)

<LocationMatch "^/etc\.clientlibs/.*\.(?i:js|css|ttf|woff2)$">
Header set Cache-Control "max-age=2592000,stale-while-revalidate=43200,stale-if-error=43200,public,immutable" "expr=%{REQUEST_STATUS} < 400"
Header set Age 0
</LocationMatch>

 

for 1 hour

 

Header set Cache-Control "max-age=3600,stale-while-revalidate=3600,stale-if-error=3600,public,immutable" "expr=%{REQUEST_STATUS} < 400"

 

Note:- Instead of refreshing whole clientlibs every hour you may create separate clientlib and write rules of 1 hour for that cleintlib only and for other clientlib you may keep 12 hrs 

 

Thanks