0

I am working on HTTP caching and to implement cache busting, I am using ACS Versioned ClientLibs. Now this works fine for js file when it is part of clientlib. For example <script src="/etc/designs/myapp/clientlibs/base.js"> works. But when I try to access an individual js within the library it doesnt work. For example <script src="/etc/designs/myapp/clientlibs/base/js/app1.js"> fails. The reason is the MD5 hash added as sling selector gets resolved when it is a clientlib js. But selector is not getting resolved when calling js individually. </base.hash.js> works but </base/js/app1.hash.js> fails.

How does AEM know to resolve selectors when calling clientlibs and doesnt do when calling individual js?

And the reason I need selectors to work specifically is, as per PageSpeed, most proxies donot cache static references with ? param. And asks to remove the query params. So I cant add query param for cache busting.

Saravana Prakash
  • 1,321
  • 13
  • 25
  • Not 100% sure, thus only as a comment and not as an answer: The combined js files are processed by AEM before it is returned and thus the hash is taken into account. The individual files seem to be sent back as a plain binaries without any processing. – Thomas Sep 01 '16 at 07:09
  • Yeah.. thats wat I too infer. But if someone throws light on whats happening, probably could think of some hotfix to work around the issue. – Saravana Prakash Sep 01 '16 at 13:47

1 Answers1

0

/etc/designs/myapp/clientlibs/base is a cq:ClientLibraryResource

/etc/designs/myapp/clientlibs/base/js/app.js is a nt:file resource.

There is no resource .../base/js/app this you can't request this resource w a selector (app.hash.js)

empire29
  • 3,729
  • 6
  • 45
  • 71
  • This is the closest answer I could get that resource resolver can parse the sling selectors only when it is a [HTMLLibrary](https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/widget/HtmlLibrary.html). In case of jcr:primaryType:nt:file, it fails to resolve as HTMLLibrary and resource resolver simply returns full text as resolved which fails ultimately. And solution to my problem am writing dispatcher rewriter to strip out selectors. – Saravana Prakash Sep 08 '16 at 14:18