我有一个Azure网站,我只用于开发和测试,因此我想限制除了我自己以外的所有人访问它.根据这篇博文文章,现在这是正式支持的,所以我尝试将其添加到我的web.config文件中:
<system.webServer>
<security>
<ipSecurity allowUnlisted="false" denyAction="NotFound">
<add allowed="true" ipAddress="1.2.3.4" />
</ipSecurity>
</security>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
对于ipAddress属性,我必须使用我的互联网连接的IP地址吗?所以我去了http://www.whatismyip.com/并复制了地址,但现在我的网站只是阻止所有请求,允许规则无效.
我错过了什么?
更新:日志文件显示Web服务器看到的IP不是实际客户端的IP,而是介于两者之间的代理(Cloudflare).所以我尝试通过添加来解决这个enableProxyMode="true"
问题,遗憾的是这不能解决我的问题.有关如何获得IP限制以使用Cloudflare的任何想法?