Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

CSS and JS not processing on the Dispatcher level

Avatar

Level 2

The CSS and JS files are processed in both author and publisher environments. But the dispatcher is not processing the same css and js files. On checking the network tab, it shows a 404 error for both CSS and JS files.

Any idea on bringing the css and js back to dispatcher URL as well?

 

Thanks in advance

 

@arunpatidar @DEBAL_DAS @BrianKasingli 

1 Accepted Solution

Avatar

Correct answer by
Level 8

Hi @nitin029 

 

I have compared all the dispatcher rules mentioned above with my existing project where the dispatcher rules works perfectly fine. Looking at the network screenshots, /etc.clientlibs is getting blocked on dispatcher. Please try these thing in your files and let me know in case you still face any issue.

 

disp-main-filter2.any

 

# 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)' }

 

# Enable clientlibs proxy servlet
/0012 { /type "allow" /method "GET" /url "/etc.clientlibs/*" }

 

# 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/*" }

 

disp-cache.any file

 

Instead of blocking the cache, allow the caching as this is the primary role of the dispatcher to cache the content and scripts.

 

# Default allow all items to cache
/0000 {
/glob "*"
/type "allow"
}

 

after that deny the items that you don't want to cache.

 

Also, keep in mind that the rules works sequentially. First we deny everything and then starts allowing the specific items.

 

Hope this helps.

 

 

View solution in original post

6 Replies

Avatar

Level 8

@nitin029 

 

Kindly share your dispatcher.any filter rules. Normally we don't write any specific rules to allow js or css. It should to cached by default until we add some rules to deny caching.

 

Check whether JS and CSS extension are allowed in your filter rules as mentioned below.

 

/005  {  /type "allow" /extension '(css|gif|ico|js|png|swf|jpe?g)' }

 

Avatar

Level 2

Hello Avinash,

The caching is denied. And the CSS and JS is allowed in the filter rules.

But still its not rendering CSS and JS.

Avatar

Level 8

@nitin029 Have you applied proxy in the clientlibs? What's the request path which is getting blocked in the dispatcher and throwing 404? 

 

In case you are using proxy clientlibs in that case you may need to add an additional rule to allow it.

 

/0029 { /type "allow" /url "/etc.clientlibs/*" }

 

Check your configurations from the one mentioned below

https://github.com/AdobeDocs/experience-manager-65.en/blob/main/help/communities/dispatcher.md 

 

 

Avatar

Level 2

Hi @AvinashGupta01 

/filter
{
$include "disp-main-filter1.any"
/1025 { /type "allow" /glob "* /content/mySiteName*" }
$include "disp-main-filter2.any"
}

inside disp-main-filter2.any

/0240 { /type "deny" /glob "* /etc/*" }
/0241 { /type "allow" /glob "* /etc.clientlibs/*" }

/0041 { /type "allow" /glob "* *.css *" } # enable css

/0044 { /type "allow" /glob "* *.js *" } # enable javascript
/0144 { /type "allow" /glob "* *.min.js *" } # enable javascript

 

corresponding disp-cache.any file:

 

/0000
{
/glob "*"
/type "deny"
}

 

I can see everything that u told is in place. But still dispatcher shows this

nitin029_0-1669287533580.png

 

nitin029_1-1669287558731.png

for both JS and CSS files.

Thanks in advance!

Avatar

Correct answer by
Level 8

Hi @nitin029 

 

I have compared all the dispatcher rules mentioned above with my existing project where the dispatcher rules works perfectly fine. Looking at the network screenshots, /etc.clientlibs is getting blocked on dispatcher. Please try these thing in your files and let me know in case you still face any issue.

 

disp-main-filter2.any

 

# 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)' }

 

# Enable clientlibs proxy servlet
/0012 { /type "allow" /method "GET" /url "/etc.clientlibs/*" }

 

# 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/*" }

 

disp-cache.any file

 

Instead of blocking the cache, allow the caching as this is the primary role of the dispatcher to cache the content and scripts.

 

# Default allow all items to cache
/0000 {
/glob "*"
/type "allow"
}

 

after that deny the items that you don't want to cache.

 

Also, keep in mind that the rules works sequentially. First we deny everything and then starts allowing the specific items.

 

Hope this helps.