简体   繁体   English

Azure应用程序网关将“/ *”转发到后端池

[英]Azure Application Gateway forwarding “/*” to Backend Pool

I have an Azure Application Gateway set up with Path-Based routing to route between two different Backend Pools. 我有一个Azure应用程序网关设置基于路径的路由,以在两个不同的后端池之间路由 I also have Application Insights configured on one of the Pools, which I will come back to in a moment. 我还在其中一个池上配置了Application Insights,稍后我会回过头来看看。 My path rule is configured like this: 我的路径规则配置如下:

/home/* -> Backend Pool 1 /* -> Backend Pool 2

I have never been able to connect to Backend Pool 1 but, I have been able to successfully connect to Backend Pool 2 at /* and when I was able to do that, going to /home/* would still be sent to Backend Pool 2 which didn't exist there. 我从来没有能够连接到Backend Pool 1但是,我已经能够成功连接到/* Backend Pool 2 ,当我能够这样做时,转到/home/*仍然会被发送到Backend Pool 2那里不存在。 I tried using the Override Backend Path setting on the HTTP Settings, but then neither route would work and I would receive a 502 error. 我尝试在HTTP设置上使用Override Backend Path设置,但是这两个路由都不起作用,我会收到502错误。 So naturally, I tried to reverse that setting, but nothing would change. 很自然地,我试图改变那个设置,但没有什么会改变。

However, I did notice in the Application Insights for Backend Pool 2 that after removing the Override Backend Path setting, that the server pool was receiving the /* as part of the request and thus, receiving a 400 error because that route doesn't exist and the character is not allowed in the URL (It's worth noting that my web.config file doesn't have request URL character restrictions right now). 但是,我在Application Insights for Backend Pool 2注意到, 在删除 Override Backend Path设置后,服务器池正在接收/*作为请求的一部分,因此收到400错误,因为该路由不存在并且URL中不允许使用该字符(值得注意的是,我的web.config文件现在没有请求URL字符限制)。

I know that this type of routing is possible, given the number of documents from Azure, but I've been dealing with this problem for two weeks and have poured over every scrap of documentation and don't seem to be getting anywhere. 我知道这种类型的路由是可行的,考虑到来自Azure的文档数量,但我已经处理了这个问题已经有两个星期了,并且已经倾倒了所有文档并且似乎没有任何进展。

So to clarify, my specific question is: 所以澄清一下,我的具体问题是:

Given the things I've already tried, am I missing something in my configuration, is something wrong about my configuration? 鉴于我已经尝试过的东西,我在配置中遗漏了什么,我的配置有问题吗?

I'd be more than happy to clarify any points that you feel I've left out. 我非常乐意澄清你认为我遗漏的任何一点。

EDIT : Adding the configuration of the one rule and its path map for context. 编辑 :添加一个规则的配置及其上下文的路径映射。

[
 {
      "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
 }

] ]

Rules are evaluated in the order they are specified. 规则按指定的顺序进行评估。 It could be that you have a basic rule preceding the path based rule. 可能是您在基于路径的规则之前有一个基本规则。 This would cause the basic rule to intercept all traffic and route to backend pool specified in that rule. 这将导致基本规则拦截所有流量并路由到该规则中指定的后端池。 If that is not the case, then pasting the rules configuration would probably help. 如果不是这样,那么粘贴规则配置可能会有所帮助。

-- Edit - 编辑

I looked at your configuration details in our monitoring system. 我在监控系统中查看了您的配置详细信息。 This is because of an incorrect probe configuration. 这是因为探针配置不正确。 You have /* in probes which is not valid. 在探针中有/ *是无效的。 The probe should point to an existing page which returns a 200 http response code. 探针应指向一个返回200 http响应代码的现有页面。 Also you do not need an path override and can be removed. 此外,您不需要路径覆盖,可以删除。 Once you have probes configured correctly, please ensure that the backend health report is showing all backend servers as healthy. 正确配置探针后,请确保后端运行状况报告显示所有后端服务器正常运行。 Then your path based rules would work as expected. 那么基于路径的规则将按预期工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 根据传入请求将请求转发到 Azure 应用程序网关后端池 header - Forwarding request to Azure Application Gateway Backend Pool depending upon Incoming request header Azure 应用程序网关 DNS 返回 307 到后端池 - Azure Application Gateway DNS returning 307 to backend pool Azure 应用程序网关未在后端池中显示来自其他 VNet 的 VM - Azure Application Gateway not showing VM from other VNet in backend pool 是否可以在没有Azure地址的情况下创建没有后端地址池的应用程序网关? - Is it possible to create a application gateway without backend address pool in azure? 应用网关后端池中的 Azure 内部负载均衡器 - Azure internal load balancer in backend pool of application gateway 一个应用程序服务环境后端池中具有多个应用程序的Azure应用程序网关 - Azure Application Gateway with multiple apps in a single App Service Environment backend pool 在 azure 应用程序网关的后端池中添加多个实例后,出现内部服务器错误 500 - getting internal server error 500, after adding multiple instances in backend pool of azure application gateway 如何将Web应用添加到Azure应用网关的后端池? - How do you add a web app to the backend pool of Azure Application Gateway? 天青网关https后端池和htaccess重定向循环 - azure gateway https backend pool and htaccess redirect loop 如何向Azure App Gateway后端池添加路径? - How to add path to an Azure App Gateway Backend Pool?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM