本文介绍了Web App的Azure WAF前端更改了主机名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的App Service的前面配置了一个Azure Web应用程序防火墙,它成功地传递了请求.我已按照以下微软文档.

I have configured an Azure Web Application Firewall in-front of my App Service and it is successfully passing requests through. I have followed the instructions a the following microsoft docs.

我有以下配置:

自定义域:test.[customdomain] .com DNS记录指向针对WAF配置的公共IP.定制域也已在Web App上配置.

Custom domain: test.[customdomain].com the DNS records points to the public IP configured against the WAF. The custom domain is also configured on the Web App.

WAF具有一个后端池,该后端池被配置为使用"IP地址或FQDN",并具有以下记录:[customwebsite] .azurewebsites.net

The WAF has a backendpool which is configured to use "IP Address or FQDN" with the following record:[customwebsite].azurewebsites.net

当我导航到test.[customdomain] .com时,我已经成功接收了该网站,但是看起来好像WAF在转发到App Service时正在重写请求.这样,我的App Service收到了请求,并且它具有URL [customwebsite] .azurewebsites.net,而不是test.[customdomain] .com.

When I navigate to test.[customdomain].com I am successfully receiving the website, however it appears as though the WAF is rewriting the request when forwarding to the App Service.As such, my App Service receives the request and it has the URL [customwebsite].azurewebsites.net, instead of test.[customdomain].com.

这是故意的吗?查看多租户文档默认情况下不应该重写主机吗?

Is this intended? Reviewing the multi-tenant documentation it should not be rewriting the host by default?

推荐答案

解决方案是确保在指定New-AzureRmApplicationGatewayBackendHttpSettings时不要使用选项-PickHostNameFromBackendAddress.我应该注意到,但是此设置告诉WAF使用BackendHttpSettings中指定的地址进行重写.

The solution was to ensure you do not use the option -PickHostNameFromBackendAddress when specifying the New-AzureRmApplicationGatewayBackendHttpSettings. I should have noticed, but this setting tells the WAF to rewrite using the addresses specified in the BackendHttpSettings.

然后,您还需要重新配置探针以指定手动主机名.例如请勿在设置AzureRmApplicationGatewayProbeConfig时指定-PickHostNameFromBackendHttpSettings.

You also then need to reconfigure your probe to specify manual hostnames. e.g. do not specify -PickHostNameFromBackendHttpSettings when setting AzureRmApplicationGatewayProbeConfig.

这篇关于Web App的Azure WAF前端更改了主机名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 18:09