1

I have a Sitecore 10.2 version multisite project. Example: Site1 and Site2 and it's deployed on Sitecore MCS. It's perfectly working fine with https://site1.com and https://site2.com on MCS non-prod environment
(note: CDN does not exist in the non-prod environment)

In Prod, environment CDN exists and I have mapped www.site2.com to CDN. So when the user will hit the Site2 request goes to the CDN and take the data from the CD server. Later I will write a redirect rule for the htts://site2.com to www.site2.com.

Now when I hit https://site2.com and it perfectly works and serves me the content of the site2.

When I request with www.site2.com it populates the content and pages of site1 instead of site2.

In theory:

There are 2 domains for Site2:

  1. https://Site2.com (CD Server)
  2. www.Site2.com (CDN endpoint)

Site2.com This is the apex (naked) domain. It has been pointed to the CD server (mc-********-****-****-****-****-cd). All users who enter this domain will reach the CD server and will need to be immediately redirected to www.Site2.com using permanent 301 redirects.

www.Site2.com This sub-domain is the main domain for Site2. This custom domain is mapped to the CDN endpoint (mc-********-****-****-****-****-cdn-endpoint) and hence all cacheable assets are cached and served through Azure CDN.

My Site Node code is:

            <site name="site2" patch:after="site[@name='website']"
              hostName="www.site2.com|site2.com"
              targetHostName="www.site2.com"
              scheme="https"
              ...........
              rootPath="/sitecore/content/Site2"
              startItem="/Home"
              database="web"
              domain="extranet"
              />
    </sites>

Does anyone encountered the same issue, please guide me.

4
  • What have you set the "origin" to be for your azure CDN? Also is there a domain mapped to the "website" site? If so try setting origin to website domain + site2 home path. I.e. site1.com/sitecore/content/site2/home Oct 5, 2022 at 6:19
  • Origin hostname for Azure CDN is my CD server: mc-********-****-****-****-****-cd.azurewebsites.net. There is only 1 CM and 1 CD server. I have mapped site2.com domain to the website CD Server. And www.site2.com domain is mapped to the CDN. Oct 5, 2022 at 6:48
  • So to confirm the website site node is mapped to site2.com on cd server? Ie. <site name="website" hostname="site2.com"> ? Oct 5, 2022 at 7:28
  • no that is to site1.com. <site name="website" hostname="site1.com"> and another one <site name="site2" hostname="site2.com"> Oct 5, 2022 at 8:34

1 Answer 1

1

This is what I believe is happening.

You have two domains hosted on Sitecore instance. Both domains have IIS bindings added to the IIS instance that is running your Sitecore instance.

In a non CDN situation, a request comes to IIS for site2.com. This is then passed on to Sitecore with the information that the request is for site2.com. Your <site name="site2"> node, recognises the incoming domain and sitecore serves data from that site configuration.

In a CDN situation, a request is made to the CDN. CDN doesnt have data, so refers back to origin domain for data. The CDN then sends a request to IIS instance on domain your-cd.azurewebsites.net. Non of your site nodes have a mapping for <site xxxx hostName = "your-cd.azurewebsites.net">. So Sitecore defaults to the "website" site node and send information back for that site configuration.

You could try adding a hostName entry on your site2 node for "your-cd.azurewebsites.net" or set origin on CDN to "your-cd.azurewebsites.net/sitecore/content/Site2" . However, this would cause you problems with site1.

I think your only solution might be to create a second CDN which is specifically for site2.com. Set the origin for that to be "your-cd.azurewebsites.net/sitecore/content/Site2".

3
  • You could try adding a hostName entry on your site2 node for "your-cd.azurewebsites.net" or set origin on CDN to "your-cd.azurewebsites.net/sitecore/content/Site2" . However, this would cause you problems with site1. ===> Yes, it will cause an issue for my Site1. Oct 5, 2022 at 9:23
  • I think your only solution might be to create a second CDN which is specifically for site2.com. Set the origin for that to be "your-cd.azurewebsites.net/sitecore/content/Site2". ==> Client dependency, does not want to purchase Oct 5, 2022 at 9:25
  • Thanks for more explanation :) Oct 5, 2022 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.