Azure前门未在浏览器中维护自定义域 [英] Azure Front Door Is Not Maintaining Custom Domain in Browser
问题描述
在Azure前门中的域:
www.foobar.com
Azure Web应用程序:
foobar-web
foobar-api
我希望能够www.foobar.com
调出Web应用程序foobar-web
并在URL中使用/api
来访问Web应用程序foobar-api
.
www.foobar.com
-> foobar-web
www.foobar.com/api
-> foobar-api
我每个都有一个后端池设置和路由规则设置.每次尝试导航到www.foobar.com/api
时,浏览器中的URL都会更改为foobar-api.azurewebsites.net/api
,但是如果我导航至中的www.foobar.com
,则会在保持浏览器中www.foobar.com
域的同时拉起foobar-web
网络应用.>
Azure前门中是否有我缺少的设置,或者需要在Web应用程序或源代码中进行配置以维护域?
该Web应用是C#ASP.NET Web API 2解决方案.
在此先感谢您的回答/建议.
最新
API的API路由规则要求您在项目中定义自己的API.这里显示的示例仅是示例代码.
我在前门的设置.
重要
经过测试,我使用虚拟应用程序来满足您的需求.
下面的屏幕截图是我的项目结构.
在部署应用程序之前,您需要修改.csproj
文件.通常,您只需要修改foobar-api
项目,如果部署失败,则可以同时修改两个项目.
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>foobar_web</RootNamespace>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
</PropertyGroup>
然后您可以部署它,我在foobar-api
项目中创建test/aa
.
网页
虚拟应用程序索引
虚拟应用程序中的Api测试
创建前门服务后,完成配置.
Web
Api
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.
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
这篇关于Azure前门未在浏览器中维护自定义域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!