0

One of my project is using Sitecore 9.1.1 & JSS, also Server Side Rendering (SSR) Mode is running successfully on Azure App Service. Ex. www.example.com - which is English language website is running successfully.

I have a requirement to run multiples JSS websites on the same Azure App Service (where English website is running) like following.

www.example.in,
www.example.uk,
www.example.de,

app.example.com --- all websites are sharing the front-end components. To optimize the cost client want to deploy and run all the websites in same app service. I have a requirement to run 30 such language websites.

I have this challenge while running in headless mode, with integrated mode above requirement works without any issue.

  • Is creating 30 app service a solution option ? it looks deployment and maintenance is going to be a challenge.

Tried multiple options, but finding difficult to implement the above requirement in the App Service. If anyone has experience or suggestion to implementing above said requirement, please share your inputs, thoughts. Also suggest if any other approach to be considered for such requirements.

Thanks in advance.

1

I would suggest not to modify your UI source code for this implementation but you can simply implement it from the node js proxy.

Define config.js for each site.

Use node vhost package to select appropriate config based on hostname.

| improve this answer | |
0

This works in Integrated Mode because in this case Sitecore is fully responsible for handling the incoming request and can easily resolve a site based on the hostname out-of-the-box. With headless mode situation is slightly different because a proxy is receiving the request first.

One way to achieve what you want would be be to update your frontend App to append the sc_site query string parameter to the Sitecore Layout Service calls. There is a nice blog post on how to do that: https://sitecore.decerno.se/post/jss-site-resolver

Alternatively, you can bind multiple hostNames your Sitecore AppService instance and make sure your frontend app is using the appropriate hostName when calling the Layout Service API. In this case Sitecore will be able to resolve proper site context based on hostname. Downside of this approach is that you will need to bind multiple hostnames to your AppService instance.

| improve this answer | |
0

There are two ways to run multi sites in headless mode.

  1. Running one headless rendering host You will need to resolve any site routing in the headless rendering host. You can take a look at the rewriteRequestPath function in https://github.com/Sitecore/jss/blob/dev/packages/sitecore-jss-proxy/src/index.ts#L288

  2. Running each site in its own individual Azure Web App as headless rendering host The Headless proxy has a configuration parameter qsParams https://github.com/Sitecore/jss/blob/dev/packages/sitecore-jss-proxy/src/ProxyConfig.ts#L13 Just hardcore the sc_site parameter (eg. sc_site=example-uk) to each config.js file, and then deploy your JSS code. There are ways to deploy to 30 Azure Web Apps in parallel using ARM templates. To save costs, you may also run all 30 Azure Web App under the same App Hosting Plan.

| improve this answer | |
  • As an alternative approach, looking at the VM based or docker based approach. – Sivalingaamorthy Aug 17 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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