1. MultisiteMiddleware

Configure the MultisiteMiddleware class locally

Version: 0.x (alpha public release)

For accurate site resolution during local development, developers are encouraged to simulate production-like domain routing by configuring custom hostnames. This can be done using the MultisiteMiddleware.

To set up and configure the MultisiteMiddleware to achieve production-like domain routing locally:

  1. Find your hosts file:

    • For macOS/Linux - /etc/hosts

    • For Windows - C:\Windows\System32\drivers\etc\hosts

  2. Add the following to point a local domain to 127.0.0.1:

    127.0.0.1 sitea.localhost 
    127.0.0.1 siteb.localhost 
  3. Update the Site Definition in SitecoreAI:

    • Navigate to /sitecore/content/YourTenant/YourSite/Settings/SiteGroup/Site Definitions.

    • Open the relevant Site Definition item (for example, sitea).

    • Add sitea.localhost to the HostName field.

This ensures consistency between your local development environment and the content served by SitecoreAI.

If you have suggestions for improving this article, let us know!