Search code examples
azureazure-front-door

I can't get Custom domains set in Azure Front Door passing along to the origins app service


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:

  1. I created a Azure Front Door with two origins App Service: myappservicetesteast.azurewebsites.net and myappservicetesteast2.azurewebsites.net
  2. 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.


Solution

  • 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