【发布时间】:2016-08-19 11:05:45
【问题描述】:
遇到限制 IP 安全的问题。 我制作了一个 web.config 文件并将其放在我试图限制的文件夹中,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<security>
<ipSecurity allowUnlisted="false" enableProxyMode="true" denyAction="Forbidden">
<clear />
<add ipAddress="123.456.789" allowed="true" />
</ipSecurity>
</security>
</system.webServer>
</configuration>
我还把 applicationHost.config 调整为:
<section name="ipSecurity" overrideModeDefault="Allow" />
但是,当浏览到该文件夹中的文件时,我得到 403。 我已经重启了 IIS 并且 IP 地址是正确的。
我错过了什么?
【问题讨论】:
-
您在 IIS 日志中看到的 IP 地址是什么?你看到 123.456.789 了吗?并且 isince proxymode 启用了 x-forwaded 标头中的内容。
-
感谢 Ravi 日志文件显示的 IP 地址 (987.654.321) 与我使用 whatmyip (123.456.789) 得到的不同。使用 enabledProxyMode="true" 它需要配置中的两个 IP 才能允许访问。我认为这与 IIS 在我的静态 IP 之前看到的代理地址有关?
-
通常情况下不应该这样。你在什么样的网络中?通常办公网络会有很多交换机,因此您将无法预测您的 IP。另一种情况是,如果您的请求在到达 IIS 之前通过代理路由。
-
是的,它是一个办公网络。我认为正如您所说,请求首先通过代理路由。谢谢你的帮助。
-
太棒了!我会将其发布为其他人的答案。
标签: security iis windows-server-2012 ip-restrictions