Proxing clientlibs in AEM

December 9, 2017    aem 6.3 clientlibs


In AEM we know that we should store final clientlib under /etc/designs/site/clientlibs because anyone has access to this node. So you are not worried when you add this clientlib on your page. Nevertheless sometimes we can see that someone has created clientlib under /apps folder and all works correctly on author instance, but when the code is deployed on publish instance nothing works as we expected.

Since AEM 6.3 you can proxy your clientclibs under /apps folder via special servlet. You just need to add special parameter for your clientlib.

Lets take a look at one of we.retail clientlibs. button clientlib

Output in html if we add this library on any page will be:

<link rel="stylesheet" href="/apps/weretail/components/content/button/clientlibs.min.css" type="text/css">

And if we will try to request this clientlib on publisher instance we will get 404 response code.

Now we will add “allowProxy” set to ‘true’ allow proxy

The new html output will be:

<link rel="stylesheet" href="/etc.clientlibs/weretail/components/content/button/clientlibs.min.css" type="text/css">

As you can see now we use ProxyServlet to get desired clientlib.

Attention

Be aware that if you will try to request /etc.clientlibs/weretail/components/content/button/clientlibs.min.css without ‘allowProxy’ set in ‘true’ you wil receive 404 response.

Blog post about clientlibs

We.Retail latest release link1 or link2




comments powered by Disqus