Azure Front Door Is Not Maintaining Custom Domain in Browser

眉间皱痕 提交于 2020-07-07 10:31:28

问题


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:


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.

PRIVIOUS

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

The screenshot below is my project structure.

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

Index of Virtual applications

Api test in Virtual applications

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

Web

Api



来源:https://stackoverflow.com/questions/62337016/azure-front-door-is-not-maintaining-custom-domain-in-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!