将不同的IP定向到IIS7上的不同页面
使用 IIS7,如何在定向外部 IP 的同时将内部 专用网络 IP 地址定向到我的网站地址到“网站正在维护”页面?
到目前为止,在 IIS7 上,我已经在 IIS 中找到了名为“IPv4 地址和域限制”的部分,并且我可以将 3 个内部范围添加到其中作为允许范围。这看起来很容易。现在,如何将所有其他流量定向到静态页面,例如我创建的 app_offline.html。 (我实际上不会使用 app_offline.html,因为这显然也会使应用程序对于内部地址脱机。)
Using IIS7, how do I direct internal private network IP's addresses to my web site while I direct external IP addresses to a "site under maintenance" page?
So far on IIS7 I've found the section in IIS named "IPv4 Address and Domain Restrictions" and I can add the 3 internal ranges to that as an allow range. That seems easy. Now how do I direct all other traffic to a static page such as app_offline.html that I have created. (I'm not actually going to use app_offline.html because that will obviously take the app offline for internal addresses as well.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 URL 重写 (http://www.iis.net/download/URLRewrite)那。
然后你可以删除一个 web.config ,其内容如下:
它基本上所做的就是仅在内容还不是“站点正在建设”页面时应用此规则(以防止无限重定向),并且仅在以下情况下应用此规则IP 地址不是来自 192.168.XXX.XXX(也不是本地主机)。
否则,他们会进入他们请求的任何页面。
请注意,这不应该用作安全机制,因为 Remote Addr 可能会被欺骗,但听起来对于您的场景来说应该没问题。
You can use URL Rewrite (http://www.iis.net/download/URLRewrite) for that.
Then you can drop a web.config with the contents like:
What it basically does is to only apply this rule if the content is not already the "site-under-construction" page (to prevent infinite redirects), and only apply this if the IP-address is not coming from 192.168.XXX.XXX (and is not localhost).
Otherwise it will let them come through to whatever page they requested.
Note that this should not be use as a security mechanism since Remote Addr could be spoofed, but sounds like for your scenario it should be fine.