AEM cloud dispatcher scripts | Community
Skip to main content
Level 2
February 26, 2025
Solved

AEM cloud dispatcher scripts

  • February 26, 2025
  • 2 replies
  • 618 views

I´m trying to get a rewriteMap for my dispatcher from a Servlet alocated on my AEm instance. Can I use in AEM cloud dispatcher some scripts like:

 

#!/bin/bash

# Llama al servlet en AEM y devuelve las reglas en formato key-value para RewriteMap curl -s https://publish-p88805-e1164595.adobeaemcloud.com/bin/servlets/proxy/map.txt

 

and then use it like:

 

RewriteMap proxyRules prg:/etc/httpd/conf.d/rewrites/map.sh

 

Has anyone faced something like that?

 

thank you all in advance!!

Best answer by konstantyn_diachenko

Hi @developer_anon ,

 

If you use AEMaaCS, you can use AEM Pipeline-free redirect that was recently introduced by Adobe. Link: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/pipeline-free-url-redirects 

 

I would suggest you to store map (proxy rules) on AEM as a simple txt file. You can use https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-map-manager/index.html. It will allow you to link it for AEM cloud dispatcher.

 

Best regards,

Kostiantyn Diachenko.

  

2 replies

Uppari_Ramesh
Level 5
February 26, 2025

Hi @developer_anon , Pls try below

 

RewriteMap testMap txt:https://publish-p88805-e1164595.adobeaemcloud.com/bin/servlets/proxy/map.txt

RewriteRule ^(.*)$ ${testMap:$1} [R=301,L]

 

Create servlet which should give response as key value in new line

 

Thanks,

Ramesh

Level 2
February 27, 2025

Hi @uppari_ramesh

Thank you for your response, I already tried that but when I try to deploy to AEM cloud instances (like dev) It shows the next error:

RewriteMap: file for map proxyRules not found:/etc/httpd/https:/publish-p88805-e1164595.adobeaemcloud.com/bin/servlets/proxy/map.txt
ERROR: '1 TEST_FAILURE '
    at reportError(/usr/local/bin/lib-status.bash:158)
    at validate_configuration(/usr/local/bin/validate-static.sh:158)
    at runValidation(/usr/local/bin/validate-static.sh:189)
    at status.track(/usr/local/bin/lib-status.bash:261)
    at main(/usr/local/bin/validate-static.sh:192)
Reporting error to: '/mnt/shared/status-validation'
ERROR: '1 SCRIPT_ERROR Script command failed (see stack trace)'
    at status.internal.handleError(/usr/local/bin/lib-status.bash:269)
    at status.track(/usr/local/bin/lib-status.bash:269)
    at main(/usr/local/bin/validate-static.sh:192)
Status file exists: '/mnt/shared/status-validation' assuming it is already saved in earlier step.
    at status.internal.handleExit(/usr/local/bin/lib-status.bash:56) exited with code '1'
 
As you can it tries to get a local file from /etc/httpd/ and then concat the servlet url given. I don´t know why. That´s the reason why I´m looking for other options like the script.
konstantyn_diachenko
Community Advisor
konstantyn_diachenkoCommunity AdvisorAccepted solution
Community Advisor
February 26, 2025

Hi @developer_anon ,

 

If you use AEMaaCS, you can use AEM Pipeline-free redirect that was recently introduced by Adobe. Link: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/pipeline-free-url-redirects 

 

I would suggest you to store map (proxy rules) on AEM as a simple txt file. You can use https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-map-manager/index.html. It will allow you to link it for AEM cloud dispatcher.

 

Best regards,

Kostiantyn Diachenko.

  

Kostiantyn Diachenko, Community Advisor, Certified Senior AEM Developer, creator of free AEM VLT Tool, maintainer of AEM Tools plugin.
Level 2
February 27, 2025

Hi @konstantyn_diachenko,

Thank you for your reply. I will try this option, seems that could work for my case. There is any other documentation about that?

I will try it and let you know if I can make it work for my scenario.

Thnak you!