Expand my Community achievements bar.

SOLVED

AEM cloud dispatcher scripts

Avatar

Level 2

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!!

1 Accepted Solution

Avatar

Correct answer by
Level 9

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/con... 

 

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.

  

View solution in original post

4 Replies

Avatar

Level 5

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

Avatar

Level 2

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.

Avatar

Correct answer by
Level 9

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/con... 

 

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.

  

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!