Expand my Community achievements bar.

SOLVED

How to managing Cross-Domain Redirects in AEM Cloud

Avatar

Level 2

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.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

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

 

 

View solution in original post

10 Replies

Avatar

Level 7

Hi @saumyaj49332255 

 

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


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 ?

Avatar

Level 9

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

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

Avatar

Level 7

@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 ?

Avatar

Level 9

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.

 

 

Avatar

Level 2

Hey @daniel-strmecki @Tethich ,

Thank you for your response!

Yes, I understand the requirement might seem unusual, but since we’re working on setting up a CDN on AEM Cloud, the client is also requesting if these redirects can be managed directly from the AEM side.

There are around 5000 redirects involved, so the client is looking for a solution within AEM that is scalable, easy to use, and author-friendly.

Avatar

Level 7

The use case is still ambiguous to me. Maybe you can share an infra diagram to understand better.
However, as I said, these are the available options for you to explore when it comes to redirects:
https://experienceleague.adobe.com/en/docs/experience-manager-learn/foundation/administration/url-re...

You already tried Redirect Map Manager and Redirect Manager, so these are out of scope.
You said you have more then 5000 redirects to manage, so using Page Redirect Property is also out of scope, as you can't manually handle this.

You are then left with managing this at AEM level using cdn.yaml as @daniel-strmecki suggested, or at edge level if you have other CDN then Fastly, like Akamai Edge Redirector or AWS CloudFront Functions.
And you can always use mod-rewrite in Dispatcher, but this is again a tedious work.

Avatar

Community Advisor

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

Avatar

Administrator

@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

Avatar

Correct answer by
Level 2

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