![](/img/trans.png)
[英]Forwarding request to Azure Application Gateway Backend Pool depending upon Incoming request header
[英]Azure Application Gateway forwarding “/*” to Backend Pool
我有一个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错误。 很自然地,我试图改变那个设置,但没有什么会改变。
但是,我在Application Insights for Backend Pool 2
注意到, 在删除 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
}
]
规则按指定的顺序进行评估。 可能是您在基于路径的规则之前有一个基本规则。 这将导致基本规则拦截所有流量并路由到该规则中指定的后端池。 如果不是这样,那么粘贴规则配置可能会有所帮助。
- 编辑
我在监控系统中查看了您的配置详细信息。 这是因为探针配置不正确。 在探针中有/ *是无效的。 探针应指向一个返回200 http响应代码的现有页面。 此外,您不需要路径覆盖,可以删除。 正确配置探针后,请确保后端运行状况报告显示所有后端服务器正常运行。 那么基于路径的规则将按预期工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.