I have created separate bindings for the basic and advanced sample JSS apps as outlined in
https://jss.sitecore.net/#/setup/sitecore-config?id=sitecore-configuration
- 127.0.0.1 JssBasicApp
- 127.0.0.1 JssAdvancedApp
This works fine. When I click through the advanced app, I can see calls to the layoutservice like:
http://jssadvancedapp/sitecore/api/layout/render/jss?item=/portfolio&sc_lang=en&sc_apikey={KEY}
However, when I don't use separate IIS bindings, but instead configure subsites for JssBasicApp and JssAdvancedApp, the layoutservice calls get problematic. When I click through the advanced sample app, in the network tab in my browser I see calls like:
http://jss-sc.com/jssadvancedapp/sitecore/api/layout/render/jss?item=/jssadvancedapp/portfolio&sc_lang=en&sc_apikey={KEY}
resulting in a 404 not found error:
http://jss-sc.com/sitecore/service/notfound.aspx?item=/sitecore/api/layout/render/jss&user=sitecore\admin&site=jssadvancedapp
Obviously, the Sitecore layoutservice is not called here, but Sitecore is trying to find the item /sitecore/api/layout/render/jss
under the JssAdvanced node.
The following call gives a 404 error (removed the jssadvancedapp section after hostname):
http://jss-sc.com/sitecore/api/layout/render/jss?item=/jssadvancedapp/portfolio&sc_lang=en&sc_apikey={KEY}
Adding &site=jssadvancedapp
to the url gives the same 404 error.
So the question is, what is the right api call? And how to set the configuration so that the right api call is made instead of the above wrong one.
This is how the sites configuration looks like:
<sites>
<site name="shell" virtualFolder="/sitecore/shell" physicalFolder="/sitecore/shell" rootPath="/sitecore/content" startItem="/home" language="en" contentLanguage="en" database="core" domain="sitecore" loginPage="/sitecore/login" content="master" contentStartItem="/Home" enableWorkflow="true" enableTracking="false" analyticsDefinitions="content" xmlControlPage="/sitecore/shell/default.aspx" browserTitle="Sitecore" htmlCacheSize="10MB" registryCacheSize="15MB" viewStateCacheSize="1MB" xslCacheSize="25MB" disableBrowserCaching="true" enableItemLanguageFallback="false" enableFieldLanguageFallback="false" itemwebapi.mode="StandardSecurity" itemwebapi.access="ReadWrite" itemwebapi.allowanonymousaccess="false" patch:source="Sitecore.Speak.ItemWebApi.config"/>
<site name="login" virtualFolder="/sitecore/login" physicalFolder="/sitecore/login" enableTracking="false" database="core" domain="sitecore" disableXmlControls="true" language="en"/>
<site name="admin" virtualFolder="/sitecore/admin" physicalFolder="/sitecore/admin" enableTracking="false" enableWorkflow="true" domain="sitecore" loginPage="/sitecore/admin/login.aspx"/>
<site name="service" enableTracking="true" virtualFolder="/sitecore/service" physicalFolder="/sitecore/service"/>
<site name="modules_shell" virtualFolder="/sitecore modules/shell" physicalFolder="/sitecore modules/shell" rootPath="/sitecore/content" startItem="/home" language="en" database="core" domain="sitecore" content="master" enableTracking="false" enableWorkflow="true"/>
<site name="modules_website" virtualFolder="/sitecore modules/web" physicalFolder="/sitecore modules/web" rootPath="/sitecore/content" startItem="/home" language="en" database="web" domain="extranet" allowDebug="true" cacheHtml="true"/>
<site name="jssadvancedapp" inherits="website" virtualFolder="/jssadvancedapp" physicalFolder="/jssadvancedapp" rootPath="/sitecore/content/jssadvancedapp" startItem="/home" database="master" patch:source="jss-advanced-app.config"/>
<site name="jssbasicapp" inherits="website" virtualFolder="/jssbasicapp" physicalFolder="/jssbasicapp" rootPath="/sitecore/content/jssbasicapp" startItem="/home" database="master" patch:source="jss-basic-app.config"/>
<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" language="en" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" enableItemLanguageFallback="false" enableFieldLanguageFallback="false" itemwebapi.mode="Off" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="false" patch:source="Sitecore.ItemWebApi.config"/>
<site name="scheduler" enableTracking="false" domain="sitecore"/>
<site name="system" enableTracking="false" domain="sitecore"/>
<site name="publisher" domain="sitecore" enableTracking="false" enableWorkflow="true"/>
<site name="exm" inherits="shell" virtualFolder="/" physicalFolder="/" startItem="/none" cacheHtml="true" htmlCacheSize="50MB" patch:source="Sitecore.EmailExperience.Core.config"/>