在Azure上基于URL路径的路由

时间:2019-05-17 15:29:02

标签: azure

我需要在Azure上进行以下配置:

  • 对www.domain.com的请求转到一个应用程序服务(称为MainAppService)
  • 向www.domain.com/blog/*请求到另一个App Service(称为BlogAppService)

重要的是,URL保持www.domain.com/blog/something(在这里对我来说,简单重定向到blog.domain.com/something无效)。

MainAppService是.Net Core应用程序,而BlogAppService应该是php(是,WordPress)。我想知道Azure Application Gateway是否是唯一的选择。是否有任何无需安装AAG的基于代码的解决方案?

1 个答案:

答案 0 :(得分:1)

据我所知,如果您想要基于代码的解决方案,则可以考虑在Web应用程序服务中添加URL rewrite rules。看来Rewrite Rules仅在一项Web应用程序服务中起作用。也就是说,您无法根据重写规则将HTTP主机www.domain.com重定向到blog.domain.com

作为您的配置,我认为Azure应用程序网关是一种简单且更好的方法。

配置示例:

Create an application gateway with path-based routing rules using the Azure portal

How to map URL path-based rules in application gateway for your Azure web app service

相关问题