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
Solved! Go to Solution.
Views
Replies
Total Likes
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.
Hi @nitin029 ,
Please check this: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-enable-caching-of-j...
Regards,
Santosh
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)' }
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.
@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
/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
for both JS and CSS files.
Thanks in advance!
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.
Views
Likes
Replies