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

Dispatcher Redirecting request for fonts to 404 error pages

Avatar

Community Advisor

Hi All,

 

I have the below scenario - 

 

1. CSS clientlibs file calling font files via url syntax as below - 

@Font-face{
font-family:icomoon;
src:url(clientlib-site/resources/icons/icomoon.eot?s69qo9);
src:url(clientlib-site/resources/icons/icomoon.eot?s69qo9#iefix) format("embedded-opentype"),
url(clientlib-site/resources/icons/icomoon.ttf?s69qo9) format("truetype"),
url(clientlib-site/resources/icons/icomoon.woff?s69qo9) format("woff"),
url(clientlib-site/resources/icons/icomoon.svg?s69qo9#icomoon) format("svg");

}

 

2. Behavior on Publish and Dispatcher - 

Publish - The clientlibs and the files (ttf | woff) are displaying 200 OK when hit.

Dispatcher - The clientlibs file is correctly hit but the icon files are redirecting to 404 pages.

rohangargTA_1-1660304358056.png

 

Fixes Tried - 

1. Updated the VHost configuration to turn on ModMimeUsePathInfo.

ModMimeUsePathInfo On 
<IfModule mod_mime.c>
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-opentype .otf
AddType image/svg+xml .svg
AddType application/x-font-ttf .ttf
AddType application/font-woff .woff
AddType application/font-woff2 .woff2
</IfModule>

 

Can you please help why the dispatcher would redirect the font request to error page with 301 ?

The other clientlibs request for CSS and JS are loading fine, the publisher is downloading the font icon when directly hit.

@Gaurav-Behl , @achennapragada , @arunpatidar , @Mohit_KBansal , @kautuk_sahni 

 

Please find the dispatcher logs below - 

HTTPD Access Logs
cm-pxxxxx-exxxxxx-aem-publish-zzzzzzzzz-yyyyy - - 12/Aug/2022:14:12:12 +0000 "GET /etc.clientlibs/brandA/clientlibs/clientlib-site/resources/icons/icomoon.ttf?s69qo9 HTTP/1.1" 301 245 "https://brandA.com/etc.clientlibs/brandA/clientlibs/clientlib-site.lc-4475042b57b4e02f2f8147fe0b49fb..." "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"


cm-pxxxxx-exxxxxx-aem-publish-zzzzzzzzz-yyyyy - - 12/Aug/2022:14:12:13 +0000 "GET /etc.clientlibs/brandA/clientlibs/clientlib-site/resources/icons/icomoon.woff?s69qo9 HTTP/1.1" 301 245 "https://brandA.com/etc.clientlibs/brandA/clientlibs/clientlib-site.lc-4475042b57b4e02f2f8147fe0b49fb..." "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"


cm-pxxxxx-exxxxxx-aem-publish-zzzzzzzzz-yyyyy - - 12/Aug/2022:14:25:36 +0000 "GET /etc.clientlibs/brandA/clientlibs/clientlib-site/resources/icons/icomoon.ttf?s69qo9 HTTP/1.1" 301 245 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"

 

Request Logs - Directly Hitting Publish
14/Aug/2022:08:46:54 +0000 [45925] -> GET /etc.clientlibs/brandA/clientlibs/clientlib-site/resources/icons/icomoon.ttf?s69qo9 HTTP/1.1 [cm-p57852-e459121-aem-publish-5498f7f4d9-rxms2]
14/Aug/2022:08:46:54 +0000 [45925] <- 200 application/x-font-ttf 9ms [cm-p57852-e459121-aem-publish-5498f7f4d9-rxms2]

 

Request Logs - When hitting same URL on dispatcher
14/Aug/2022:08:10:09 +0000 [41611] -> GET /etc.clientlibs/brandA/clientlibs/clientlib-site/resources/icons/icomoon.ttf?s69qo9 HTTP/1.1 [cm-p57852-e459121-aem-publish-5498f7f4d9-rxms2]
14/Aug/2022:08:10:09 +0000 [41611] <- 404 - 12ms [cm-p57852-e459121-aem-publish-5498f7f4d9-rxms2]

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi All,

 

The problem is now resolved.

 

Checking the Publish's Error Log I found the issue below - 

14.08.2022 08:10:09.651 [cm-pxyxyx-eyyyyyy-aem-publish-54abcdefd9-rxms2] *INFO* [122.177.105.119 [1660464609650] GET /etc.clientlibs/brandA/clientlibs/clientlib-site/resources/icons/icomoon.ttf HTTP/1.1] com.adobe.granite.ui.clientlibs.impl.ClientLibraryProxyServlet Proxy request to /etc.clientlibs/brandA/clientlibs/clientlib-site/resources/icons/icomoon.ttf not supported.

 

The sling mapping for etc.clientlibs was missing in dispatcher which solved the issue.

View solution in original post

7 Replies

Avatar

Level 3

Hi @Rohan_Garg ,

I believe it must be issue with rewrites. Can you please share the full path of the sample file (e.g. icomoon.ttf)

Avatar

Level 3

Hi @Rohan_Garg ,

Please try the following

  1. Please make sure if those file extensions are allowed in the conf.d/filters
  2. Once they are allowed in filters and still receiving 404, try adding some additional rewrite like this in your rewrites(for testing

Thanks,

Anil.

Avatar

Community Advisor

1. The files are allowed in dispatcher configuration - Ideally dispatcher should have thrown 403 forbidden if filters were blocking the request.

 

# This rule allows content to be access
/0010 { /type "allow" /extension '(css|eot|gif|ico|jpeg|jpg|js|gif|pdf|png|svg|swf|ttf|woff|woff2|html|mp4|mov|m4v)' /path "/content/*" } # disable this rule to allow mapped content only

# Enable specific mime types in non-public content directories
/0011 { /type "allow" /method "GET" /extension '(css|eot|gif|ico|jpeg|jpg|js|gif|png|svg|swf|ttf|woff|woff2)' }

  

2. Can you please provide a sample of the rewrites rule you are referring to in the above comment ?

Avatar

Level 3

Please find below the sample rewrite (for testing). The below rewrite would be applicable to shortened urls and ends with only .html extension

 

#Redirect for all the shortened pages with html

RewriteCond %{REQUEST_URI} !^/?(etc.clientlibs|resources|libs|content|libs|apps) [NC]

RewriteCond %{REQUEST_URI} ^/(.*).html$

RewriteRule ^/(.*) /content/<projectname>/us/en/$1 [PT,L,QSA]

Avatar

Community Advisor

I tested on the https://technicalseo.com/tools/htaccess/ all my rewrite rules to see if any can interfere with my request URL - none of them is passing the rewrite conditions or passing the rewrite rule criteria.

Request URL - https://domainA.com/etc.clientlibs/domainA/clientlibs/clientlib-site/resources/icons/icomoon.woff?s6...

The initiator for this resource is a clientlib min.css file which is being handled by dispatcher correctly - 

https://domainA.com/etc.clientlibs/domainA/clientlibs/clientlib-site.lc-4474712b67b4e02f2f4673fe0b49...

 

All Rewrite Rules in sequence - 

1. # Add .html extension when extension is missing from request
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]*[^./])$ https://%{SERVER_NAME}$1.html [R=301,L]

 

2. #Rewrite for Root Direction

RewriteRule "^(/?)$" "/content/brandA/us/en/home.html" [PT,L]

 

3. Rewrite for URL Shortening

RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/bin
#RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{REQUEST_URI} !^/libs
RewriteCond %{REQUEST_URI} !^/saml_login
RewriteCond %{REQUEST_URI} !^/system
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteCond %{REQUEST_URI} (.html|.jpe?g|.png|.svg|.xml)$
#RewriteRule ^/content/brandA/us/en/(.*)$ /$1 [NE,L,R=301]
RewriteRule ^/content/brandA/us/en/(.*)(\.html)?$ https://%{SERVER_NAME}/$1 [NE,L,R=301]

 

4. #Replace the .html with /
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^/(.*).html$ https://%{SERVER_NAME}/$1/ [R=301,L,QSA]

 

5. #Append the .html for those URL’s ending with / before sending to publisher
#This rule should not work for requests originating with non /content/brandA domains and should also work for shortened URLs
RewriteCond %{REQUEST_URI} !^/content/brandB
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^/(.*)/$ /content/brandA/us/en/$1.html [PT,L,QSA]

 

6. RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/bin
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{REQUEST_URI} !^/libs
RewriteCond %{REQUEST_URI} !^/saml_login
RewriteCond %{REQUEST_URI} !^/system
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteCond %{REQUEST_URI} (.html|.jpe?g|.png|.svg)$
RewriteRule ^/(.*)$ /content/brandA/us/en/$1 [NC,PT,L]

Avatar

Correct answer by
Community Advisor

Hi All,

 

The problem is now resolved.

 

Checking the Publish's Error Log I found the issue below - 

14.08.2022 08:10:09.651 [cm-pxyxyx-eyyyyyy-aem-publish-54abcdefd9-rxms2] *INFO* [122.177.105.119 [1660464609650] GET /etc.clientlibs/brandA/clientlibs/clientlib-site/resources/icons/icomoon.ttf HTTP/1.1] com.adobe.granite.ui.clientlibs.impl.ClientLibraryProxyServlet Proxy request to /etc.clientlibs/brandA/clientlibs/clientlib-site/resources/icons/icomoon.ttf not supported.

 

The sling mapping for etc.clientlibs was missing in dispatcher which solved the issue.