Azure App Gateway给出错误404,但后端探针运行正常

Azure App Gateway gives Error 404 but backend probe is healthy

我已经设置了应用程序网关,并在我的域中添加了CNMAME,以指向应用程序网关的DNS名称。该应用程序网关最终将指向3个站点。我创建了3个Web应用程序,并将每个应用程序都添加到了后端池中。我最初使用默认的HTTP设置(appGatewayBackendHttpSettings
),但意识到我需要指向3个健康状况调查,因此我复制了此HTTP设置并将其分配给其中一个侦听器,并将其指向该站点之一的健康状况调查。

然后,我如下配置了我的applicationgateway,但是即使探针显示出健康状态,导航到该站点时也会出现404错误。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
mydomainListener
Frontend IP Configuration : appGatewayFrontendIP
FrontendPort : appGatewayFrontendPort (443)
hostname : test.mydomain.com
Protocol : HTTPS
Certificate : test-cert
Associated Rule : testRule

TestRule
Type: Basic
Backendpool:testBackendPool
HTTP setting : testHTTPSetting

testHTTPSetting
Cookie based affinity : Disabled
Connection draining : Disabled
Protocol : HTTPS
Port : 443
Backend authentication certificates :mycert
Use a Custom Prove : testHTTPSProbe
Request Timeout : 30

testHTTPSProbe:
Host : test-azurewebsites.net
Protcol  : HTTPS
Path : /
Interval : 30
Timeout 30
Unhealthy Threshold : 3
Minimum healthy servers :0


好吧,我怀疑这是由于您需要配置Web应用程序以使用自定义域名这一事实。当请求到达他们时,请求正在寻找mydomain.com,但是您的网站仅在test.azurewebsites.net上监听。

导航到webapp>自定义域>加号图标>验证>添加。您可以阅读链接的文章以了解更多详细信息,也可以按照屏幕提示进行操作

参考:https://docs.microsoft.com/zh-cn/azure/app-service/app-service-web-tutorial-custom-domain

ps。或者,您可以使用后端hostname属性将主机名发送到后端服务器

参考:
https://docs.microsoft.com/zh-CN/cli/azure/network/application-gateway/http-settings?view=azure-cli-latest#az-network-application-gateway-http-settings-create
https://docs.microsoft.com/zh-cn/rest/api/application-gateway/applicationgateways/createorupdate#applicationgatewaybackendhttpsettings