Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

c# - Azure Front Door Is Not Maintaining Custom Domain in Browser

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...