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/"
/>
Sitecore.ExperienceEditor.Pipelines.HttpRequest.ResolveSite, Sitecore.ExperienceEditor
class. Are you able to attach to your website process and set a breakpoint in theProcess
method of this class?<HostName>
and<TargetHostName>
in the site definition of all of your sites?