my XM Cloud project was setup by following https://github.com/sitecorelabs/xmcloud-foundation-head. So by default all the multisite plugin has been setup. I'm able to see the list of available sites in src/sxastarter/scripts/config/plugins/multisite.ts

[{ name: 'Site A', hostName:* , language: 'en' },{
name: 'Site B', hostName: , language: 'en' } ]

What I want is when user visit www.siteA.com, we will render the sitecore content from Site A, and the same for Site B. But the situation right now, no matter which hosts, the layoutservice is always pointing to Site A This is how I set JSS_APP_NAME in .env file

JSS_APP_NAME=["Site A","Site B"]

So how can I set the site name and its content based on hostname? Is it because the hostname is set as * so it don't understand? Below is my config file at src/sxastarter/src/temp/config.js

const config = {};
config.sitecoreApiKey = process.env.SITECORE_API_KEY config.sitecoreApiHost = process.env.SITECORE_API_HOST || '',
config.jssAppName = process.env.JSS_APP_NAME
config.graphQLEndpointPath = process.env.GRAPH_QL_ENDPOINT_PATH || '/sitecore/api/graph/edge',
config.defaultLanguage = process.env.DEFAULT_LANGUAGE || 'en',
config.graphQLEndpoint = process.env.GRAPH_QL_ENDPOINT
config.layoutServiceConfigurationName = process.env.LAYOUT_SERVICE_CONFIGURATION_NAME || 'sxa-jss',
config.sites = process.env.SITES || '["name":"Site A","hostName":"*","language":"en"},{"name":"Site B","hostName":"*","language":"en"}]',
module.exports = config;

1 Answer 1


Each of your sites will have a Site Definition item under the Site Grouping folder in /siteroot/settings/Site Grouping

You need to make sure the host name in there matches your host name used to view the site. Once you have set those, you will need to restart your next.js application.

  • Hi Richard, I tried to set hostname as localhost:3000 for Site A and localhost:3001 for Site B. But when I access localhost:3001, all the content or assets is still pointing to Site A instead of Site B
    – rayray
    Commented Jan 14 at 3:32
  • And also should I set JSS_APP_NAME=["Site A","Site B"]?
    – rayray
    Commented Jan 14 at 5:08
  • I know what went wrong, I didn't set up the site idetifier, after I set it as default then its working now. Thank you for it
    – rayray
    Commented Jan 14 at 7:46

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