'Running two Azure Web Apps on different subdomains of the same domain
I have a multi-tenant web app where each tenant has their own subdomain -- tenant.thing.co.uk
.
Can I set up two Azure Web Apps on different subdomains and move the tenant to a sub-sub domain like this:
tenant.app1.thing.co.uk
andtenant.app2.thing.co.uk
?
In the Azure Web App under Custom domains I can enter *.app1.thing.co.uk
and add TXT
and CNAME
records to my DNS to get the validation to pass: there is one TXT
record and two CNAME
records:
| Name | Data |
| -----| -------------- |
| app1 | thing-app.azurewebites.net |
| app2 | thing-app2.azurewebsites.net |
But it doesn't work! (Firefox says: Server not found.)
However, if I add one CNAME
for *.thing.co.uk
and add *.app1.thing.co.uk
to one Azure Web App (and delete the other Azure Web App) then the website appears and the tenant subdomains work.
So: what's going wrong with two apps?
Solution 1:[1]
Add an A Record for each subdomain pointing to the IP address of each App Service.
Solution 2:[2]
The answer appears to be:
In DNS:
- add a
TXT
record with nameasuid.subdomain
for each subdomain, and - add a
CNAME
record with name*.subdomain
and value the azure web app domain name.
In Custom domains for the Azure web app:
- add a custom domain
*.subdomain.domain.tld
, and - add a custom domain
subdomain.domain.tld
.
So the fix for me was to add two -- not one -- custom domains in the Azure website.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Matt Small |
Solution 2 | Richard Barraclough |