How to managing Cross-Domain Redirects in AEM Cloud | Community
Skip to main content
saumyaj49332255
Level 2
November 14, 2024
Solved

How to managing Cross-Domain Redirects in AEM Cloud

  • November 14, 2024
  • 5 replies
  • 2798 views

I am working on a POC focused on migrating a large set of cross-domain redirects to AEM as a Cloud Service. My organization currently operates two websites:

  1. Website A (main site): Currently hosted on Brightspot and in the process of being migrated to AEM Cloud (about 30% complete).
  2. Website B: Hosted on WordPress, with no plans to migrate the entire site to AEM. However, the goal is to migrate all redirect rules for Website B to AEM.

The redirect rules for Website B aim to redirect its pages to equivalent or related pages on Website A. This setup requires cross-domain redirects from Website B’s domain to Website A’s domain.

Requirements and Current Investigation:

  • Redirect Volume: Approximately 5,000 redirects, so the solution needs to be manageable and scalable.
  • Redirect Solutions in AEM Cloud: I have explored options like Redirect Manager and Redirect Map Manager; however, these tools appear to be optimized for internal redirects within the same domain.

Questions:

  1. CDN Configuration: What updates are required in the CDN settings to ensure it can handle cross-domain redirects for Website B?
  2. Dispatcher Configuration: What specific changes are needed in the AEM Dispatcher to support and properly route these cross-domain redirects?
  3. Management Approach: Given the high volume of redirects, what is the recommended approach in AEM for managing this setup?

Any guidance on best practices and configurations for handling cross-domain redirects in this setup would be highly appreciated.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by saumyaj49332255

The issue was resolved by implementing a two-way redirect rule. We configured a CDN rule in the CDN.yaml file to redirect all requests from Website B to Website A in the specified format. Additionally, we used the Redirect Manager to set up internal rules. This approach allows us to handle approximately 5000 redirects individually without needing a common regex pattern for the paths.

The key requirement for this setup is that Website B must route through the AEM Managed CDN for the redirection rules to function correctly. Once this is in place, the traffic will be redirected as expected.

 

 

redirects: rules: - name: redirect-cross-domain when: reqProperty: domain equals: website-b-domain action: type: redirect status: 301 location: reqProperty: path transform: - op: replace match: '^/(.*)$' replacement: '<https://website-a-domain/webiste-b-com/\1.html'>

 

 

5 replies

Tethich
Community Advisor
Community Advisor
November 14, 2024

Hi @saumyaj49332255 

 

AEM documentation for redirects is https://experienceleague.adobe.com/en/docs/experience-manager-learn/foundation/administration/url-redirection


Maybe I am not getting your problem, but as long as you need to redirect only from the Wordpress hosted pages to the AEM hosted pages, why would you need to setup any redirects within AEM ? Aren't they suppose to be configured only in Wordpress ?

daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
November 14, 2024

Hi @saumyaj49332255,

since the site you are redirecting to is not on AEM, it would be best to use CDN redirects: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/cdn-configuring-traffic?lang=en#client-side-redirectors

It doesn't really make sense to hit origin (AEM/Dispatcher) and then redirect to another origin. However, given the large number of redirects you need, please be aware that the max size of the OOTB Adobe CDN configuration file cannot exceed 100 KB. Therefore, you need to check if this is enough for you and allows you some space to grow.

In case you are using a custom CDN, then you don't have this problem and you should definitely go with CDN redirects.

 

Hope this helps,

Daniel

Tethich
Community Advisor
Community Advisor
November 15, 2024

@daniel-strmecki
I am still confused. The aim was:
"The redirect rules for Website B aim to redirect its pages to equivalent or related pages on Website A. This setup requires cross-domain redirects from Website B’s domain to Website A’s domain."
Why do we need to setup any redirects in AEM CDN ?

daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
November 15, 2024

Hi @tethich,

good point, I am not sure, only if they use AEM's CDN for both domains/hosts. I guess the author can clarify.

 

 

Community Advisor
November 15, 2024

With DNS mapping, a domain can either be pointed to a single domain (CNAME) or to a set of IP addresses (A-Record). From my understanding, the domain for Website B may currently point to your WordPress server or a CDN/load balancer, while Website A points to AEM as a Cloud CDN.

Ideally, redirects from Website B URLs to Website A URLs should be managed on the server or CDN handling Website B.

If it’s necessary for AEM as a Cloud platform to manage these redirects, you could proxy Website B through AEM as a Cloud CDN. This would allow requests for Website B URLs to be directed to the WordPress platform, while other redirects could be managed within AEM, assuming a recognizable pattern to distinguish these requests.

For more information, refer to Configuring Traffic at the CDN | Adobe Experience Manager.

Several approaches are available for enabling redirects:

  • ACS Commons Redirect Manager
  • Map Manager
  • AEM as a Cloud CDN Redirects (note that managing a large volume of redirects may be challenging)

Regards,
Albin
https://myprofile.albinsblog.com

kautuk_sahni
Community Manager
Community Manager
November 25, 2024

@saumyaj49332255 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni
saumyaj49332255
Level 2
November 26, 2024

Hey @kautuk_sahni - Yes shared the approach that we followed. 

saumyaj49332255
saumyaj49332255AuthorAccepted solution
Level 2
November 26, 2024

The issue was resolved by implementing a two-way redirect rule. We configured a CDN rule in the CDN.yaml file to redirect all requests from Website B to Website A in the specified format. Additionally, we used the Redirect Manager to set up internal rules. This approach allows us to handle approximately 5000 redirects individually without needing a common regex pattern for the paths.

The key requirement for this setup is that Website B must route through the AEM Managed CDN for the redirection rules to function correctly. Once this is in place, the traffic will be redirected as expected.

 

 

redirects: rules: - name: redirect-cross-domain when: reqProperty: domain equals: website-b-domain action: type: redirect status: 301 location: reqProperty: path transform: - op: replace match: '^/(.*)$' replacement: '<https://website-a-domain/webiste-b-com/\1.html'>