Search code examples
asp.net-coreazure-front-door

What's the correct way to set up multiple Web Apps behind Azure Front Door?


I have three backend pools, 1 is an API and 2 are Web Apps. I've set up routing in Azure Front Door to route to the correct areas, but how do I modify the web apps to use the Front Door URL for all of the links without having to hardcode them all manually?

For example, if the Front Door URL is frontdoor.azurefd.net but Web App 1 is published to webapp1.azurewebsites.net how can I set the root url of webapp1 such that all of the Razor Areas actually link to frontdoor.azurefd.net/webapp1?


Solution

  • If you want to access the different backend pool based on the path URL with Azure front door, you must make sure the virtual path existence. For example, you have to add the virtual directory /webapp1 in your app service like this: enter image description here

    So you could access your webapp1 via URL https://xxx.azurewebsites.net/webapp1. Then you could add /webapp1/* or /webapp1 in the PATTERNS TO MATCH and modify the Forwarding protocol is match request in your routing rule. enter image description here

    After this, you could access the URL frontdoor.azurefd.net/webapp1 for your webapp1. The same configuration is for the other two backends and routing rules.

    For more reference: https://learn.microsoft.com/en-us/azure/frontdoor/front-door-route-matching