I have a JSS multi-site setup under one tenant. I have Site A and Site B. I have modified the routeHandler.js to use a different layout based on the sitecore context Sitename value.
// Render the app's root structural layout
if(this.props.ssrState.sitecore.context.site.name === "sitea"){
return (
// <Layout route={routeData.sitecore.route} />
(this.state.isLoading) ?
<Loading isLoading={true}/> :
<SiteaLayout route={routeData.sitecore.route} />
);
}else if(this.props.ssrState.sitecore.context.site.name === "siteb"){
return (
// <Layout route={routeData.sitecore.route} />
(this.state.isLoading) ?
<Loading isLoading={true}/> :
<SiteBLayout route={routeData.sitecore.route} />
);
}
I have configured the two hostnames inside of sitecore under "Setting Site Grouping" for Site A and Site B. My issue is when browsing Site B it is showing Site A. Its using Site A's content and layout even though I'm browsing Site B's configured hostname. Only way I can force Site B to show the correct content/use the correct layout is with the "?sc_site=SiteB" in the querystring. Any suggestions on how to configure Site B to always use the right content and layout?
Sitecore 9.2 JSS - Headless Proxy