Azure的网站IP限制 [英] Azure website IP restriction

查看:307
本文介绍了Azure的网站IP限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Azure的网站,我只用于开发和测试,所以我想限制访问它适合所有人,但我自己。
根据本<一href=\"http://azure.microsoft.com/blog/2013/12/09/ip-and-domain-restrictions-for-windows-azure-web-sites/\"相对=nofollow>博客文章,这就是现在的正式支持,所以我尝试添加这到我的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地址?于是我去 http://www.whatismyip.com/ 并复制该地址,但现在我的网站是简单地阻止所有请求,允许规则没有效果。

For the ipAddress attribute I have to use the IP address of my internet connection right? So I went to http://www.whatismyip.com/ 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限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆