Expand my Community achievements bar.

Need inputs on preferred approach to fix Capital JPEG issue via Dispatcher in AMS

Avatar

Level 3

Hi All,

 

We are facing an issue, where the images from DAM are giving 404 NOT FOUND error when accessed via Dispatcher (We are using AMS in our Project).

 

We debugged and found that the issue is appearing as we have name of images as "abc.JPG" instead of "abc.jpg" in AEM. These images are being sent via Magento, thats the reason it has Largecase chars in the file extension (e.g. JPG). 

 

Approach 1:

We tried to make modification in "ams_publish_filters.any" file to allow an additional extension "JPG" in the "/content", but in AMS its being immutable file we are not able to modify it. Could any one suggest, how this can be overlayed and additional extension can be added in filter.any file.

 

Approach 2:

Also, I could think of an additional approach, where we modify DAM Update Asset workflow to smallcase the extension (e.g. jpg) upon upload of asset.

 

Could anyone please suggest, which should be the preferred approach for this.

 

Thanks..

Regards,

Aman

 

9 Replies

Avatar

Community Advisor

Hi @amanagarwal21 

 

You can add the below rewrite rule to force lower case of the URL.

 

#Rule to ignore Case
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} ^(.*)[A-Z]+(.*)$
RewriteCond %{REQUEST_URI} !.*\..*$
RewriteRule (.*) ${lc:$1} [R,L]

 

Thanks! 

Avatar

Level 3

Thanks for the reply @Asutosh_Jena_ 

 

If I understood correctly, I suppose its a rewrite rule to update the URL to allow Uppercase..?

 

Also could you please share in what file should this be updated as we have huge-list of files in AMS that are IMMUTABLE when deploying via Cloud Manager.

 

Ref: https://helpx.adobe.com/experience-manager/kb/ams-dispatcher-manual/immutable-files.html

Here is a sample response of which files are immutable:

 
/etc/httpd/conf/httpd.conf   Immutable
/etc/httpd/conf.d/available_vhosts/aem_author.vhost Immutable
/etc/httpd/conf.d/available_vhosts/aem_publish.vhost Immutable
/etc/httpd/conf.d/available_vhosts/aem_lc.vhost Immutable
/etc/httpd/conf.d/available_vhosts/aem_flush.vhost Immutable
/etc/httpd/conf.d/available_vhosts/aem_health.vhost Immutable
/etc/httpd/conf.d/available_vhosts/000_unhealthy_author.vhost Immutable
/etc/httpd/conf.d/available_vhosts/000_unhealthy_publish.vhost Immutable
/etc/httpd/conf.d/rewrites/base_rewrite.rules Immutable
/etc/httpd/conf.d/rewrites/xforwarded_forcessl_rewrite.rules Immutable
/etc/httpd/conf.d/whitelists/000_base_whitelist.rules Immutable
/etc/httpd/conf.d/dispatcher_vhost.conf Immutable
/etc/httpd/conf.d/logformat.conf Immutable
/etc/httpd/conf.d/security.conf Immutable
/etc/httpd/conf.modules.d/02-dispatcher.conf Immutable
/etc/httpd/conf.dispatcher.d/available_farms/000_ams_author_farm.any Immutable
/etc/httpd/conf.dispatcher.d/available_farms/999_ams_publish_farm.any Immutable
/etc/httpd/conf.dispatcher.d/available_farms/001_ams_lc_farm.any Immutable
/etc/httpd/conf.dispatcher.d/cache/ams_author_cache.any Immutable
/etc/httpd/conf.dispatcher.d/cache/ams_author_invalidate_allowed.any Immutable
/etc/httpd/conf.dispatcher.d/cache/ams_publish_cache.any Immutable
/etc/httpd/conf.dispatcher.d/cache/ams_publish_invalidate_allowed.any Immutable
/etc/httpd/conf.dispatcher.d/clientheaders/ams_author_clientheaders.any Immutable
/etc/httpd/conf.dispatcher.d/clientheaders/ams_publish_clientheaders.any Immutable
/etc/httpd/conf.dispatcher.d/clientheaders/ams_common_clientheaders.any Immutable
/etc/httpd/conf.dispatcher.d/clientheaders/ams_lc_clientheaders.any Immutable
/etc/httpd/conf.dispatcher.d/filters/ams_author_filters.any Immutable
/etc/httpd/conf.dispatcher.d/filters/ams_publish_filters.any Immutable
/etc/httpd/conf.dispatcher.d/filters/ams_lc_filters.any Immutable
/etc/httpd/conf.dispatcher.d/renders/ams_author_renders.any Immutable
/etc/httpd/conf.dispatcher.d/renders/ams_publish_renders.any Immutable
/etc/httpd/conf.dispatcher.d/renders/ams_lc_renders.any Immutable
/etc/httpd/conf.dispatcher.d/vhosts/ams_author_vhosts.any Immutable
/etc/httpd/conf.dispatcher.d/vhosts/ams_publish_vhosts.any Immutable
/etc/httpd/conf.dispatcher.d/vhosts/ams_lc_vhosts.any Immutable
/etc/httpd/conf.dispatcher.d/dispatcher.any Immutable

Avatar

Community Advisor

You need to add a custom file and apply the rewrite. This rewrite will force all the URLs to lower case so if your file has JPG it will be converted into jpg and requested from publish.

 

Thanks!

Avatar

Level 3

Hi @Asutosh_Jena_ ,

I followed the same steps, but after adding the shared rewrite rule at the path \dispatcher\src\conf.d\rewrites\custom_rewrites.rules did not resolve the issue.

 

Regards,
Aman 

Avatar

Level 3

Could you pls share, how can I verify that.

Sorry, I am not aware of much dispatcher related steps, Just Learning.

Avatar

Community Advisor

Hi @amanagarwal21 - 

You are right, the ams publish filter is immutable. So, you need to have a custom file to update the filter rules. Approach is as below:

 

1. You need to clone the ams_publish_filters.any file into a custom, project specific filter file like %custom_name%_publish_filters.any.

2. Update this file with the rule to allow 'JPG'.

3. Include this file in your project specific farm.any file.

4. If you don't have a custom farm.any file, then create a custom one like 998_%custom_name%_publish_farm.any by cloning the 999_ams_publish_farm.any file in the available_farms folder.

5. Now create a softlink to the newly created file within the enabled_farms folder, and delete the softlink for 999_ams_publish_farm.any.

 

Thanks,

Fani

 

Avatar

Level 3

Thanks for the reply @Fanindra_Surat 

 

I have created a custom ignore case rule and added it in custom file \dispatcher\src\conf.d\rewrites\custom_rewrite.rules file

 

Kindly let me know, if I need to do any further steps of vhost/ farm as well and pls let know the steps post this, if possible.

 

Thanks a lot.

 

Regards,

Aman

Avatar

Community Advisor

Hi,

you can create another cutsom file which allow to add custom filters and add this file to publish farm.

Custom file : /dispatcher/src/conf.dispatcher.d/filters/custom_publish_filters.any

Filter section in publihs farm file

/etc/httpd/conf.dispatcher.d/filters/custom_publish_filters.any



Arun Patidar