April 26, 2020
Estimated Post Reading Time ~

Access ClientLibs under apps folder through ClientLibraryProxyServlet

AEM provides the ClientLibs feature to organize JS and CSS. Clientlibs can be created as

Approach 1: Place all files under /etc/designs/{project}/clientlibs path.
Approach 2: Creating clientlibs under each component. The disadvantage with this approach is it increases the number of calls to load clientlibs throughout the page. This doesn't follow best practices as CSS will not be loaded in the head section.
Approach 3: Place clientlibs under /apps/project/. /apps folder is restricted to access by a dispatcher. So we need to enable ClientLibraryProxyServlet to access the clientlibs from the apps folder. Below are the steps to enable clientLibrary Proxy.

Create a new client library under /apps/... with a new category. Let's say myapp.all
Add an embed property and include all modular component library. (firstcomp,secondcomp)
Add boolean allowProxy = 'true'
On the headlibs.jsp include the above
Then the clientlib will then be proxied via there bypassing access control settings on the clientlib.


Configure dispatcher.any to allow for /etc.clientlibs/


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.