0

When trying to preview an item the resolved site and context do not belong to the correct site chosen in our multisite setup.

Rendering.SiteResolving is true.

Rendering.SiteResolvingMatchCurrentSite is true.

Preview.ResolveSite is true.

sc_site is correctly named as per site config.

If I edit the site configuration so the names don't match then I correctly get an error, and reverting gets me a successful load but the wrong site has been resolved. So my problem is that my multisite setup does not resolve the correct site when previewing despite the config being set up for it.

I use Sitecore 9.1, so many of the older fixes do not apply. (I assume) No related errors are thrown in the log, and I have been unable to figure out how to debug the site resolving process. I could use some pointers on where and how to find the error, so far I've tried to debug from the Sitecore context to try and catch when the context.Site object gets assigned but no luck. Any help is appreciated.

Edit: This is an example of one of the sites:

<site name="abstract-site-definition"
        virtualFolder="/"
        physicalFolder="/"
        startItem="/FrontPage"
        database="web"
        domain="extranet"
        allowDebug="true"
        cacheHtml="true"
        htmlCacheSize="50MB"
        enablePreview="true"
        enableWebEdit="true"
        enableDebugger="true"
        disableClientData="false"
        formsRoot="{GUID}"
        scheme="https"
        externalPort="80"
        enableItemLanguageFallback="true"
        enableFieldLanguageFallback="true"
        />
<site name="name1" patch:before="site[@name='website']"
            inherits="abstract-site-definition"
            hostName="hostname1"
            targetHostName="hostname1"
            language="se"
            rootPath="/sitecore/content/itemName1/"
      />
4
  • I assume that the site resolving for the Experience Editor is done in the Sitecore.ExperienceEditor.Pipelines.HttpRequest.ResolveSite, Sitecore.ExperienceEditor class. Are you able to attach to your website process and set a breakpoint in the Process method of this class? Sep 14, 2020 at 11:47
  • @SebastianLay I have been trying to debug through Sitecore.Pipelines.HttpRequest.siteResolver but I'm not all variables are obtainable, and haven't to find anything useful. I don't see the class you are refering to.
    – Benjamin
    Sep 14, 2020 at 13:52
  • Did you explicitly fill out your <HostName> and <TargetHostName> in the site definition of all of your sites? Sep 14, 2020 at 18:31
  • @Marcel yes I have filled out hostname and targethostname for all the sites.
    – Benjamin
    Sep 14, 2020 at 19:07

2 Answers 2

0

I believe the context is set by the users login so if you log in to mysite1/sitecore that will be the context that the Experience Editor works in. You can of course change it using the nav bar but not really what you are looking for

0

I faced same issue for my Multisite website where Multiple domains used (Pipe separated) in Site definition Host name. I did below mentioned four config settings and its resolved.

In Sitecore.config set,

Rendering.SiteResolving is true.

Rendering.SiteResolvingMatchCurrentSite is true.

Preview.ResolveSite is true.

In Sitedefinition.config

Set specific TargetHostName for every site.

Hope that helps.

1
  • This doesn't fix the problem!
    – Dash
    Jul 2, 2021 at 3:42

Your Answer

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

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