multidomain configuration issue | Community
Skip to main content
Level 4
July 8, 2024
Solved

multidomain configuration issue

  • July 8, 2024
  • 5 replies
  • 1117 views

Hi Team,

        we are in AEMasCS, we are facing an issue below. We have 5 different domain url example show below as below.

 

www.site-A.com

www.site-B.com

www.site-C.com

www.site-D.com

www.site-E.com

 

below content path

/content/site-A/en/home.html

/content/site-B/en/home.html

/content/site-C/en/home.html

/content/site-D/en/home.html

/content/site-E/en/home.html

 

when we hit www.site-A.com/home.html - working as expected,

when we gave path and hit like www.site-A.com/content/site-B/en/home.html  - it should redirect to 404(page not found) page but its rendering site-B content from site-A domain. which is wrong as per logic.

 

Any idea about this issue and how to solve it?

 

org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.cfg.json - configuration

{
"resource.resolver.mapping": [
"/:/",
"/content/site-A/en/</",
"/content/site-B/en/</",
"/content/site-C/en/</",
"/content/site-D/en/</",
"/content/site-E/en/</"
]
}

 

 

 

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 aanchal-sikka

@rajat168 

 

For a multi-domain set-up, we should use Dispatcher rewrites.

 

A general flow of Dispatcher configs look like this

 

You would need to create separate rewrite files for each domain.

Then assure each vhost only includes the relevant rewrite file only.

 

JcrResourceResolverFactoryImpl would not be able to do domain->path mapping

5 replies

arunpatidar
Community Advisor
Community Advisor
July 8, 2024

Hi @rajat168 
From rewrite rule, you can block anything which start from /content except DAM and XF.(Please check other whitelist patterns as well)

Example Rule:

# condition to handle /content except /content/dam/* and /content/experience-fragments/* and redirect to 404 RewriteCond %{REQUEST_URI} ^/content RewriteCond %{REQUEST_URI} !^/content/dam RewriteCond %{REQUEST_URI} !^/content/experience-fragments RewriteRule ^/content.*$ - [R=404,L]

 

Arun Patidar
Himanshu_Jain
Community Advisor
Community Advisor
July 8, 2024
kautuk_sahni
Community Manager
Community Manager
July 8, 2024

@rajat168 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
kautuk_sahni
Community Manager
Community Manager
July 8, 2024

@rajat168 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
aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
July 9, 2024

@rajat168 

 

For a multi-domain set-up, we should use Dispatcher rewrites.

 

A general flow of Dispatcher configs look like this

 

You would need to create separate rewrite files for each domain.

Then assure each vhost only includes the relevant rewrite file only.

 

JcrResourceResolverFactoryImpl would not be able to do domain->path mapping

Aanchal Sikka
rajat168Author
Level 4
July 9, 2024

thanks much for detailed explanation @aanchal-sikka