TransWikia.com

Creating multi site using Sitecore JSS

Sitecore Asked by haappyy02 on August 23, 2021

I am new to creating Multisite using Sitecore JSS. Little confused with what configuration should I go ahead with,

Current configuration,

  1. We have currently 1 site added to the site node in Sitecore.config, say "abc-single-azurewebsites.net"
  2. We have 1 jss app which is using below configuration,
    • layoutServiceHost": "https://abc-single-azurewebsites.net"
    • deployUrl": "https://abc-single-azurewebsites.net/sitecore/api/jss/import"
    • ApiKey : Created api key in sitecore
    • DeploySecret : auto generated

New requirement:

We want to add another site. Hence we have added another site to the sites node say "xyz-single-azurewebsites.net"

We are trying to create another jss app for site 2. While setting up the jss app, we are little confused in what values to provide for "layoutServiceHost" and "deployUrl".
We have created new api key in sitecore.

Can anyone help me with below questions,

  1. What will be the value for "layoutServiceHost" and "deployUrl" since we will be using same sitecore instance for both the apps ?
  2. for multi site should we add another app service in azure or should we add another url to the existing app service ?

Thanks

One Answer

Based on recent development on Sitecore JSS with Multisite, if each site has its own JSS App, then your setup will be as follows:

What will be the value for "layoutServiceHost" and "deployUrl" since we will be using same sitecore instance for both the apps

Site A

layoutServiceHost": "https://abc-single-azurewebsites.net"
deployUrl": "https://abc-single-azurewebsites.net/sitecore/api/jss/import"
ApiKey : Created api key in sitecore
DeploySecret : auto generated

Site B

layoutServiceHost": "https://xyz-single-azurewebsites.net"
deployUrl": "https://xyz-single-azurewebsites.net/sitecore/api/jss/import"
ApiKey : Created api key in sitecore
DeploySecret : auto generated

The reason of setting up the layoutServiceHost to the URL of the site is because when Sitecore will try to resolve the Site Context, it will check the URL. The URL is use because the there are no sc_site querystring. If you set it up on the same URL as Site A, when you will load connected graphql from Site B, it will not resolve to the proper Site Context.

You may have more information at those 2 articles written by my colleague

For multi site should we add another app service in azure or should we add another url to the existing app service

Since you are using the same Sitecore instance, you can just add the url to the existing app service so that it use the same Sitecore instance.

Correct answer by Walid Rohiman on August 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP