Expand my Community achievements bar.

SOLVED

How does etc.clientlibs work ??

Avatar

Level 1

All the clientlibs are transferred from  ui.frontend (dist) to ui.apps (<project_name>/clientlibs) using AEM clientlib

Then when the package is installed to AEM instance they can be found in JCR under
/apps/<project_name>/clientlibs (exact structure from ui.apps) 
but in my case we are importing the clientlibs to base AEM component using the path
"/etc.clientlibs/<project_name>/clientlibs/clientlib-angular.js" 
1 ) 
How is the GET endpoint exposed for the above path ???
2) Is there an already exisiting servlet for the same??
In my case /apps/<project_name>/clientlibs/ has all the files for me. I dont see anything inside etc/clientlibs

In the usage of clientlibs also 

<script type="text/javascript" src="/etc/clientlibs/foundation/jquery.js"></script>

this is described as one of the methods of including clientlibs .

3) s etc/clientlibs also exposed from a servlet ??

4) And if etc.clientlibs AND etc/clientlibs are exposed endpoints where is it in AEM docs ??

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi @KunalNa1 ,

 

Adobe recommends storing client libraries under /apps to ensure better organization and maintainability. However, since direct access to the /apps path is restricted on the publisher instance, client libraries placed there cannot be accessed directly.

To securely expose these client libraries, AEM provides a proxy servlet, which serves them via the virtual path /etc.clientlibs/, rather than their actual location in /apps. This mechanism allows access while ensuring that ACLs on the original /apps folder remain enforced. For this to work, the allowProxy property must be set to true in the client library configuration.

In contrast, /etc/clientlibs/ is a physical path in AEM that directly serves files without requiring a proxy servlet. Any client libraries placed under this path are accessible by default.

Hope this helps!
Thanks.

 

View solution in original post

4 Replies

Avatar

Correct answer by
Level 2

Hi @KunalNa1 ,

 

Adobe recommends storing client libraries under /apps to ensure better organization and maintainability. However, since direct access to the /apps path is restricted on the publisher instance, client libraries placed there cannot be accessed directly.

To securely expose these client libraries, AEM provides a proxy servlet, which serves them via the virtual path /etc.clientlibs/, rather than their actual location in /apps. This mechanism allows access while ensuring that ACLs on the original /apps folder remain enforced. For this to work, the allowProxy property must be set to true in the client library configuration.

In contrast, /etc/clientlibs/ is a physical path in AEM that directly serves files without requiring a proxy servlet. Any client libraries placed under this path are accessible by default.

Hope this helps!
Thanks.

 

Avatar

Level 4

Hi @KunalNa1 

 

1 ) How is the GET endpoint exposed for the above path ???  this is the Proxy Client Libraries servlet. the original path of the clientlibs that is in /apps gets updated with /etc.clientlibs when you enable the property "allowProxy" as true for the clientlibs. please refer to this - https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/int...

 

2) Is there an already exisiting servlet for the same??
In my case /apps/<project_name>/clientlibs/ has all the files for me. I dont see anything inside etc/clientlibs

this is the OOTB proxy servlet which is responsible to pick the actual file and that /etc.clientlibs is a proxy path which was introduced for security reasons so that original /apps hierarchy is never exposed.


In the usage of clientlibs also 

<script type="text/javascript" src="/etc/clientlibs/foundation/jquery.js"></script>

this is described as one of the methods of including clientlibs .

3) s etc/clientlibs also exposed from a servlet ?? /etc/clientlibs was used in older versions of AEM where the clientlibs was actually used to be stored under /etc and then later on it was moved to /apps and for the security reasons a proxy servlet with a dummy starting path /etc.clientlibs/ was introduced to mask the /apps path for better security as /apps is crucial for internal purposes and should not be exposed via dispatcher.

4) And if etc.clientlibs AND etc/clientlibs are exposed endpoints where is it in AEM docs ??

just to confirm etc.clientlibs is a proxy endpoint to access clientlibs within /apps and whereas /etc/clientlibs was the place where major legacy clientlibs are residing and earlier versions of AEM projects used to store over there.

please refer to this. https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/int...

Avatar

Level 5

Avatar

Employee Advisor

In earlier versions clientlibs were delivered via /etc/clientlibs; and that was a direct path in the repository, and the files were served directly from these locations. Suffered from a number of problems...

 

/etc.clientlibs is a servlet bound to that path, and for that reason in /etc.clientlibs/<project>/clientlibs/angular.js the "<project>/clientlibs/angular.js is a suffix, which is then looked up in a number of different paths (see the property "Allowed Library Paths" in the OSGI configuration for "Adobe Granite HTML Library Manager").