如何通过 IP 地址阻止对子域的访问
How to block access to sub-domain by IP address
我正在使用 Azure 网络应用程序,需要阻止对我的预上线环境的访问。
我已尝试使用此处提出的建议,但它似乎不起作用:https://learnwithshahriar.wordpress.com/2015/08/06/azure-website-101-restrict-access-on-your-staging-site/
我的例子:
<rewrite>
<rules>
<rule name="Block unauthorized IP to dev site" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^dev-slot.example.com" />
<add input="{REMOTE_ADDR}" pattern="111.222.333.444" negate="true"/>
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Site is not accessible" />
</rule>
</rules>
</rewrite>
它基本上什么都不做,我尝试了各种小改动都没有效果。
Matt,您是否希望简单地阻止 web.config 中的 IP 地址?我在 Azure Web 应用程序中测试了以下内容,并且能够阻止访问。希望这有帮助。
<configuration>
<system.webServer>
<security>
<ipSecurity allowUnlisted="true">
<clear/> <!-- removes all upstream restrictions -->
<add ipAddress="83.116.19.53"/> <!-- block one IP -->
<add ipAddress="83.116.119.0" subnetMask="255.255.255.0"/> <!--block network 83.116.119.0 to 83.116.119.255-->
</ipSecurity>
</security>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
参考站点:https://www.stokia.com/support/misc/web-config-ip-address-restriction.aspx
我正在使用 Azure 网络应用程序,需要阻止对我的预上线环境的访问。
我已尝试使用此处提出的建议,但它似乎不起作用:https://learnwithshahriar.wordpress.com/2015/08/06/azure-website-101-restrict-access-on-your-staging-site/
我的例子:
<rewrite>
<rules>
<rule name="Block unauthorized IP to dev site" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^dev-slot.example.com" />
<add input="{REMOTE_ADDR}" pattern="111.222.333.444" negate="true"/>
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Site is not accessible" />
</rule>
</rules>
</rewrite>
它基本上什么都不做,我尝试了各种小改动都没有效果。
Matt,您是否希望简单地阻止 web.config 中的 IP 地址?我在 Azure Web 应用程序中测试了以下内容,并且能够阻止访问。希望这有帮助。
<configuration>
<system.webServer>
<security>
<ipSecurity allowUnlisted="true">
<clear/> <!-- removes all upstream restrictions -->
<add ipAddress="83.116.19.53"/> <!-- block one IP -->
<add ipAddress="83.116.119.0" subnetMask="255.255.255.0"/> <!--block network 83.116.119.0 to 83.116.119.255-->
</ipSecurity>
</security>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
参考站点:https://www.stokia.com/support/misc/web-config-ip-address-restriction.aspx