Matching a tenant per domain instead of per path
Now comes another very exciting part that I’ve been waiting for. In this section, we will match our tenants via custom domains (hostnames). I’d like to say upfront that if you’re happy with the solely path-based multi-tenancy choice, you can skip this part; mapping domains isn’t a necessity for the rest of this project but it’s quite interesting to learn how to achieve it.
Note
We are changing the way the paths are resolved in this section as we want to, for example, be able to visit packt.local:3000
instead of the localhost:3000/packt
URL. That means the URL localhost:3000/packt will not be available after this change. However, you will still be able to use localhost for convenience as shown in the section Bringing back localhost with mapped domains.
Here, the goal is that each tenant’s login page can be reached via tenant-domain.ending/
and its Ticket Management UI can be reached at...