【发布时间】:2018-12-07 19:03:59
【问题描述】:
我有一个使用 Path-Based routing 设置的 Azure 应用程序网关,用于在两个不同的后端池之间进行路由。我还在其中一个池上配置了 Application Insights,稍后我将返回。我的路径规则是这样配置的:
/home/* -> Backend Pool 1
/* -> Backend Pool 2
我一直无法连接到Backend Pool 1,但是,我已经能够在/* 上成功连接到Backend Pool 2,当我能够做到这一点时,仍然会发送到/home/* Backend Pool 2 那里不存在。我尝试在 HTTP 设置中使用 Override Backend Path 设置,但是这两个路由都不起作用,我会收到 502 错误。所以很自然地,我试图扭转那个设置,但什么都不会改变。
但是,我确实在 Backend Pool 2 的 Application Insights 中注意到 在删除 Override Backend Path 设置后,服务器池正在接收 /* 作为请求的一部分,因此,收到 400 错误,因为该路由不存在并且 URL 中不允许使用该字符(值得注意的是,我的 web.config 文件现在没有请求 URL 字符限制)。
鉴于来自 Azure 的文档数量,我知道这种类型的路由是可能的,但我已经处理这个问题两周了,并且倾注了所有文档碎片,似乎没有得到任何结果.
所以澄清一下,我的具体问题是:
鉴于我已经尝试过的事情,我的配置中是否缺少某些内容,我的配置是否有问题?
我非常乐意澄清您认为我遗漏的任何要点。
编辑:添加一个规则的配置及其上下文路径图。
[
{
"backendAddressPool": null,
"backendHttpSettings": null,
"etag": "<####>",
"httpListener": {
"id": "<####>",
"resourceGroup": "<####>"
},
"id": "<####>",
"name": "HttpsPaths",
"provisioningState": "Succeeded",
"redirectConfiguration": null,
"resourceGroup": "<####>",
"ruleType": "PathBasedRouting",
"type": null,
"urlPathMap": {
"defaultBackendAddressPool": {
"id": "<####>/backendPool1",
"resourceGroup": "<####>"
},
"defaultBackendHttpSettings": {},
"defaultRedirectConfiguration": null,
"etag": "<####>",
"id": "<####>",
"name": "HttpsPaths",
"pathRules": [
{
"backendAddressPool": {
"id": "<####>/backendPool1"
},
"backendHttpSettings": {
"id": "<####>/OverrideBackendPathSettings (redirects to '/' on the backend)",
"resourceGroup": "<####>"
},
"etag": "<####>",
"id": "<#####>",
"name": "home",
"paths": [
"/home/*"
],
"provisioningState": "Succeeded",
"redirectConfiguration": null,
"resourceGroup": "<####>",
"type": null
},
{
"backendAddressPool": {
"id": "<####>/BackendPool2",
"resourceGroup": "<####>"
},
"backendHttpSettings": {
"id": "<####>/appGatewayBackendHttpSettings (sends request as is)",
"resourceGroup": "<####>"
},
"etag": "<####>",
"id": "<####>/gryphon",
"name": "gryphon",
"paths": [
"/*"
],
"provisioningState": "Succeeded",
"redirectConfiguration": null,
"resourceGroup": "<####>",
"type": null
}
],
"provisioningState": "Succeeded",
"resourceGroup": "<####>",
"type": null
},
"provisioningState": "Succeeded",
"resourceGroup": "<####>",
"type": null
}
]
【问题讨论】:
-
我也没有成功使用
Override Backend Path选项。我得出的结论是,当我在该字段中插入任何值时,我从网关返回500错误,因此此设置不起作用。相反,似乎我必须在目标服务器中创建虚拟文件夹(例如/home在您的情况下)才能使其正常工作。我希望我是不正确的,我只是做错了什么!
标签: azure routing azure-application-gateway