1
votes

Domain in Azure Front Door:
www.foobar.com

Azure Web Apps:
foobar-web
foobar-api

I would like to be able to have www.foobar.com pull up the web app foobar-web and utilize /api in the url to access the web app foobar-api.

www.foobar.com -> foobar-web
www.foobar.com/api -> foobar-api

I have a backend pool setup for each and route rules setup. Each time I try navigating to www.foobar.com/api the url in the browser changes to foobar-api.azurewebsites.net/api, but if I navigate to www.foobar.com in pulls up the foobar-web web app while maintaining the www.foobar.com domain in the browser.

Is there a setting in Azure Front Door that I am missing or something that needs to be configured in the web app or source code to maintain the domain?

The web app is a C# ASP.NET Web API 2 solution.

Thank you in advance for any answers/suggestions.

1
I think my answer is a easy way to solve your issue. I have try to use two different webapps in front door, it always have some problem, maybe need use other services like application gateway.Jason Pan

1 Answers

0
votes

Newest

The API routing rules for APIs require you to define your own in the project. The examples shown here are only sample code.

My settings in front door.

enter image description here

PRIVIOUS

After my testing, I used Virtual applications to fulfill your needs.

enter image description here

The screenshot below is my project structure.

enter image description here

Before you deploy your app, you need to modify .csproj file. Generally, you just need to modify foobar-api project, if deploy failed you can modify both two projects.

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RootNamespace>foobar_web</RootNamespace>
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
    <AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
</PropertyGroup>

Then you can deploy it, I create test/aa in foobar-api project.

Web page

enter image description here

Index of Virtual applications

enter image description here

Api test in Virtual applications

enter image description here

After creating the front door service, after the configuration is complete.

Web

enter image description here

Api

enter image description here