问题描述
我有三个后端池,一个是API,两个是Web Apps.我已经在Azure前门中设置了路由以路由到正确的区域,但是如何修改Web应用程序以对所有链接使用前门URL,而不必手动对其进行硬编码?
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?
例如,如果前门URL是frontdoor.azurefd.net,但Web App 1已发布到webapp1.azurewebsites.net,我如何设置webapp1的根URL,以便所有剃刀区域"实际上都链接到frontdoor. azurefd.net/webapp1?
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?
推荐答案
如果要使用Azure前门基于路径URL访问其他后端池,则必须确保虚拟路径存在.例如,您必须像这样在应用程序服务中添加虚拟目录/webapp1
:
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:
因此您可以通过URL https://xxx.azurewebsites.net/webapp1
访问您的webapp1.然后,您可以在要匹配的模式中添加/webapp1/*
或/webapp1
,并在路由规则中将转发协议修改为match request
.
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.
此后,您可以访问webapp1的URL frontdoor.azurefd.net/webapp1
.其他两个后端和路由规则的配置相同.
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.
更多参考: https://docs .microsoft.com/en-us/azure/frontdoor/front-door-route-matching
这篇关于在Azure前门后面设置多个Web应用程序的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!