Expand my Community achievements bar.

SOLVED

Issue with cached html files while using versioned clientlibs

Avatar

Level 4

Hi,

We have tried the versioned clientlibs provided by ACS AEM Commons, it is working as per documentation. We are getting the hashcoded JS/CSS files generated post every deployment (if there are changes related to JS/CSS)

All the pages[.html] which are not cached are picking the latest hash coded js/css files.

It’s not picking the latest hash coded js/css files for the pages[.html] which are cached in dispatcher.

Scenario:

Let’s consider three pages

  1. Home page (Cached in Dispatcher)
  2. Search (Not Cached in Dispatcher)
  3. About us (Not Cached in Dispatcher)

Expected Result:

Whenever there is a deployment all the three pages has to pick the latest hash coded JS/CSS files without clearing the dispatcher cache.

Actual Result:

But in our case post every deployment, when there is a request for home page, it is picking the cached html file (which has reference to old hash coded JS file), since we are caching the home page[.html].

Options we tried are,

  • If we delete the old cached JS/CSS file, then the cached HTML pages are throwing 404 error. (To resolve this we need to clear the cached html files also)
  • It is working fine for the pages that are not cached [.html]

Source link:

https://adobe-consulting-services.github.io/acs-aem-commons/features/versioned-clientlibs/index.html

Note: We are using AEM 6.2 SP1 CFP4 with IIS 8 dispatcher

Regards

Teja G

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

cleaning it manually (or via script) is the easiest way. You should make this a part of your deployment procedure.

Jörg

View solution in original post

3 Replies

Avatar

Employee Advisor

That's by design. You are supposed to clear the cache on deployment.

Background: Typically you just don't change the JS/CSS clientlibs, but you also make changes to the HTML markup itself. So in order to make the new clientlibs working you need to have adjusted the HTML as well. That's the reason why clearing the dispatcher cache is a typical task on deployments.

Of course there are rare cases where your changes to JS/CSS do not require any change on the HTML markup. But these are quite rare, so it does not justify the effort of implementing a special handling just for this case.

Does that make sense?

Jörg

Avatar

Level 4

Yes, Thanks for the reply.

Is there any other feasible way where we can avoid manual clearing cache activity for .html files?

/Teja

Avatar

Correct answer by
Employee Advisor

cleaning it manually (or via script) is the easiest way. You should make this a part of your deployment procedure.

Jörg