Azure的网站IP限制

编程入门 行业动态 更新时间:2024-10-27 14:18:50
本文介绍了Azure的网站IP限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个Azure的网站,我只用于开发和测试,所以我想限制访问它适合所有人,但我自己。根据本博客文章,这就是现在的正式支持,所以我尝试添加这到我的web.config文件:

I have an Azure website which I only use for development and testing, therefore I want to restrict access to it for everyone but myself. According to this blog article this is now offically supported, so I tried adding this to my web.config file:

<system.webServer> <security> <ipSecurity allowUnlisted="false" denyAction="NotFound"> <add allowed="true" ipAddress="1.2.3.4" /> </ipSecurity> </security> </system.webServer>

有关的ip地址属性我必须用我的互联网连接的IP地址?于是我去 www.whatismyip/ 并复制该地址,但现在我的网站是简单地阻止所有请求,允许规则没有效果。

For the ipAddress attribute I have to use the IP address of my internet connection right? So I went to www.whatismyip/ and copied the address, but now my website is simply blocking all requests, the allow rule has no effect.

我错过了什么?

更新日志文件显示,由Web服务器看到的IP地址是不与实际的客户端,但代理之间(的CloudFlare)。所以,我想加入 enableProxyMode =真正的,遗憾的是这并没有解决我的问题,解决这个问题。如何获得IP限制与CloudFlare的工作呢?任何想法

UPDATE: The log files revealed that the IPs seen by the web server are not those of the actual clients, but of a proxy in between (Cloudflare). So I tried to solve this by adding enableProxyMode="true", unfortunately this does not fix my issue. Any ideas of how to get IP restrictions to work with Cloudflare?

推荐答案

万一有人试图用的CloudFlare设置IP限制:该解决方案不仅是为了你的IP地址添加到白名单中,也是所有CloudFlare的IPS(从这里采取)。

Just in case someone is trying to setup IP restrictions with Cloudflare: the solution is to not only add your IP to the whitelist, but also all the Cloudflare IPs (taken from here).

<system.webServer> <security> <ipSecurity enableProxyMode="true" allowUnlisted="false" denyAction="NotFound"> <!-- YOUR IP --> <add allowed="true" ipAddress="1.2.3.4" /> <!-- CLOUDFLARE --> <add allowed="true" ipAddress="199.27.128.0" subnetMask="255.255.248.0" /> <add allowed="true" ipAddress="173.245.48.0" subnetMask="255.255.240.0" /> <add allowed="true" ipAddress="103.21.244.0" subnetMask="255.255.252.0" /> <add allowed="true" ipAddress="103.22.200.0" subnetMask="255.255.252.0" /> <add allowed="true" ipAddress="103.31.4.0" subnetMask="255.255.252.0" /> <add allowed="true" ipAddress="141.101.64.0" subnetMask="255.255.192.0" /> <add allowed="true" ipAddress="108.162.192.0" subnetMask="255.255.192.0" /> <add allowed="true" ipAddress="190.93.240.0" subnetMask="255.255.240.0" /> <add allowed="true" ipAddress="188.114.96.0" subnetMask="255.255.240.0" /> <add allowed="true" ipAddress="197.234.240.0" subnetMask="255.255.252.0" /> <add allowed="true" ipAddress="198.41.128.0" subnetMask="255.255.128.0" /> <add allowed="true" ipAddress="162.158.0.0" subnetMask="255.254.0.0" /> <add allowed="true" ipAddress="104.16.0.0" subnetMask="255.240.0.0" /> </ipSecurity> </security> </system.webServer>

更多推荐

Azure的网站IP限制

本文发布于:2023-07-16 05:54:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1118567.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:网站   Azure   IP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!