Multisite configuration in Next.js application using Middleware
This is a very common requirement where we need to achieve the multisite/multitenant capability while developing Next JS frontend application using Sitecore CMS in headless manner. Next.js application uses Next.js Middleware to serve the correct Sitecore site based on the incoming hostname. Middleware Middleware allows you to run code before a request is completed. It allows you to add additional functionality or perform tasks such as modify response by redirecting, rewriting, modifying the headers. Multisite add-on By default, the Next.js Multisite add-on fetches a list of site information directly from your Sitecore instance, and all sites are statically generated at build time. It also uses Next.js Middleware to serve the correct Sitecore site. But Multisite add-on have there own limitations where config-based site definitions are not currently included. Only SXA-based sites will be fetched. You can add this add-on using the JSS initializer . An XM Cloud project base...