Expand my Community achievements bar.

SOLVED

multidomain configuration issue

Avatar

Level 5

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/</"
]
}

 

 

 

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@rajat168 

 

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

 

A general flow of Dispatcher configs look like this

 

aanchalsikka_1-1720493821079.png

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

View solution in original post

6 Replies

Avatar

Community Advisor

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

Avatar

Administrator

@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

Avatar

Administrator

@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

Avatar

Correct answer by
Community Advisor

@rajat168 

 

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

 

A general flow of Dispatcher configs look like this

 

aanchalsikka_1-1720493821079.png

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