I have one app service with many custom domains and I want to set it up using Azure Front Door and increase availability of the application but got stuck managing the custom domains and passing those along to the App Services.
Here is my scenario:
We have one App Service: myappserviceeast.azurewebsites.net where currently are set many custom domains (multi tenant application) where the backend needs to capture the custom domain in the requests.
Here is what I’ve done so far:
- I created a Azure Front Door with two origins App Service: myappservicetesteast.azurewebsites.net and myappservicetesteast2.azurewebsites.net
- Set a custom domain at Azure Front Door level: test.mydomain.com
I can access the application with the custom domain test.mydomain.com, but in the backend the Host is still being myappservicetesteast.azurewebsites.net. Even though the URL in the browser shows test.mydomain.com
How I can pass the custom domain along to the region’s App Service so the backend code acknowledge which custom domain the requests are coming from?
I feeling I missing something in routing configuration perhaps.
2
Answers
Azure Front Door sets the originally requested Host in the
X-Forwarded-Host
header towards the backend. You should be able to pull it out from there.https://learn.microsoft.com/en-us/azure/frontdoor/front-door-http-headers-protocol#from-the-front-door-to-the-backend
I tried to reproduce the same in my environment I got the results successfully like below:
Created azure front door with custom domain like below:
In backend pool added two origins App Service regionA and regionB with same priority and weight like below:
To pass the custom domain along to the region’s App Service:
In Routing rule Make sure to select the domin to associate specfic role
frontends/domins
and protocolHTTP and HTTPS
like below:When I try to access my url it redirect it redirect with reguion A and B successfully like below:
Reference:
Add a custom domain to Azure Front Door | Microsoft Learn
https://kvaes.wordpress.com/2018/10/25/putting-azure-frontdoor-in-front-of-your-webapp/