Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Why does AEM force us to place fonts under clientlib/resources/fonts ?

Avatar

Level 1

We have a requirement in our project where we are using a 3rd party node_module in the ui.frontend module and packaging the css from that node module into a clientlib-site.

 

The css in that node module is such that it has references to font files with the path "../fonts/..." not "../../resources/fonts/"

Is there some way we can make the path /etc.clientlibs/<myproject>/clientlibs/clientlib-site/fonts/<font-filename>

 

Do we need to create our own proxy servlet for this ?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

It forces you to do so because from dispatcher all nodes are not accessible to the end users as it will create a security issue. That’s why they have predefined the path where you can put your own custom code, js or css. If the reference fonts in outside of clientlibs the the problem might arise abs clientlibs are being called with proxy servlet /etc.clientlibs so your referenced fonts should also follow the same path with your default behaviour and with security concern you don’t want to open other paths for clientlibs 

View solution in original post

2 Replies

Avatar

Employee Advisor

Hi,

 

If you need to modify the path of the font files referenced in the CSS, you can consider creating a proxy servlet in your AEM project. The proxy servlet can intercept requests for the font files and rewrite the URLs to match the desired path, such as /etc.clientlibs/<myproject>/clientlibs/clientlib-site/fonts/<font-filename>.

Avatar

Correct answer by
Community Advisor

It forces you to do so because from dispatcher all nodes are not accessible to the end users as it will create a security issue. That’s why they have predefined the path where you can put your own custom code, js or css. If the reference fonts in outside of clientlibs the the problem might arise abs clientlibs are being called with proxy servlet /etc.clientlibs so your referenced fonts should also follow the same path with your default behaviour and with security concern you don’t want to open other paths for clientlibs