AEM As Cloud | SVG images in the clientlibs resources are not picking the cache rules. | Community
Skip to main content
VeenaVikraman
Community Advisor
Community Advisor
February 9, 2024

AEM As Cloud | SVG images in the clientlibs resources are not picking the cache rules.

  • February 9, 2024
  • 4 replies
  • 1784 views

Hi Team

 

I'm hoping someone can help clarify an issue I'm facing with caching SVG assets in ClientLibs. I have implemented rules in the dispatcher (similar to the ones below) that should ideally set a max-age for assets within the ClientLibs loaded via etc.clientlibs. However, when I run a Lighthouse report, I'm not seeing any of the SVG assets in the resources folder being cached properly.

 

<LocationMatch "^/etc\.clientlibs/.*\.(?i:json|png|gif|jpe?g|svg)$">
Header set Cache-Control "max-age=15780000,s-maxage=86400,stale-while-revalidate=43200,stale-if-error=43200,public"
Header set Age 0
</LocationMatch>

I've verified that:

  • The similar rules on other assets in the content/dam folder. 
  • The SVG assets are located within the resources folder of the ClientLib.

I am not sure if it is not applying only for SVG from etc.clientlibs. or other assets like JPEG or PNG as I do not have such files in resources as of now. I cannot deploy them as this issue is observed in the client server. 

 

AEM version: AEM As Cloud

 

TIA

Veena✌

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

4 replies

arunpatidar
Community Advisor
Community Advisor
February 9, 2024
VeenaVikraman
Community Advisor
Community Advisor
February 9, 2024

@arunpatidar But it says , that is for HTML/TEXT

Imran Khan
Community Advisor
Community Advisor
February 11, 2024

@veenavikraman There should be any issue with default.any file as by default we allow all files to get cache.. Please check your cache rules files if it is not having any space or typo. Also, please check logs 

VeenaVikraman
Community Advisor
Community Advisor
February 12, 2024

@imran__khan The rule in my OP is the exact rule , we have in the dispatcher. Do you see any issue with this rule ? I checked for typos. Doesn't seem to have any space. 

yashp0808
Level 3
February 12, 2024

@veenavikraman  you can try to add a path independent rule like -

 

<LocationMatch "\.(jpg|jpeg|png|gif|svg|bmp)$">
Header set Cache-Control "max-age=2592000, s-maxage=31536000, stale-while-revalidate=30, stale-if-error=60, public"
</LocationMatch>

kautuk_sahni
Community Manager
Community Manager
February 16, 2024

@veenavikraman Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni