Dispatcher case insensitive for extension | Adobe Higher Education
Skip to main content
Level 3
July 23, 2023
解決済み

Dispatcher case insensitive for extension

  • July 23, 2023
  • 2 の返信
  • 1027 ビュー

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-to-make-case-insensitive/m-p/262419

このトピックへの返信は締め切られました。
ベストアンサー rampai

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 

2 の返信

rampai
Community Advisor
rampaiCommunity Advisor回答
Community Advisor
July 23, 2023

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 

arunpatidar
Community Advisor
Community Advisor
July 24, 2023