Expand my Community achievements bar.

SOLVED

Dispatcher case insensitive for extension

Avatar

Level 3

Hi,

Below are the extensions are allowed from publish filters

webp|css|eot|gif|ico|jpeg|jpg|js|gif|pdf|xml|png|svg|swf|ttf|woff|woff2|txt|html|htm|doc|docx|zip|transform|csv|mp4|ppt|pptx|xls|xlsx|png|bmp|tif|tiff|rtf

But when we try to access below assets they are blocked from dispatcher level. Can anyone suggest how to make above extension case insensitive?

 

test.Jpeg, foo.JPG, test.PDF.

I gone through the below question but his code is not visible -

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-dispatcher-filter-how-...

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi @ramaem12 ,

 

AEM dispatcher filters use POSIX expressions and the existing suggestions for the ways to implement case insensitive match do not seem to be working.

 

I have tried out 

'(webp|css|eot)/i'
'(?i)(webp|css|eot)'
'((?i)webp|(?i)css|(?i)eot)'

But none of these are working.

 

Better option is to try and get the request extension and convert it to lowercase using mod_rewrite.

 

Below is something that works for converting incoming request to lowercase.

 

<IfModule mod_rewrite.c>
RewriteEngine	on
RewriteMap lc int:tolower
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
</IfModule>

 

Also, please check link shared by Arun if that helps.

 

Thanks,

Ram 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 6

Hi @ramaem12 ,

 

AEM dispatcher filters use POSIX expressions and the existing suggestions for the ways to implement case insensitive match do not seem to be working.

 

I have tried out 

'(webp|css|eot)/i'
'(?i)(webp|css|eot)'
'((?i)webp|(?i)css|(?i)eot)'

But none of these are working.

 

Better option is to try and get the request extension and convert it to lowercase using mod_rewrite.

 

Below is something that works for converting incoming request to lowercase.

 

<IfModule mod_rewrite.c>
RewriteEngine	on
RewriteMap lc int:tolower
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
</IfModule>

 

Also, please check link shared by Arun if that helps.

 

Thanks,

Ram