Expand my Community achievements bar.

SOLVED

need to modify header for clientlibs cache

Avatar

Level 2

my project clientlib-react.lc-e686exxxxxxxlc.min.js file has below headers , 

please advice how to  reducing this cache to 1hr 

Vishnu9_0-1722936407570.png

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Vishnu9 ,

You may use dispatcher Header set

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/con...

 

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

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @Vishnu9 ,

You may use dispatcher Header set

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/con...

 

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

Avatar

Community Advisor

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

Avatar

Administrator

@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