[英]Blocking IIS rewrite by IP address
我一直在使用運行 IIS 7 的 Win Server 2008 作為反向代理服務器,它允許我在單個公共 IP 地址后面擁有多個 web 服務器。 我已經為每個 web 服務器配置了 IIS 7 重寫規則,如下所示:
{HTTP_HOST} Matches the pattern (domain_A.com) Rewrite http://<Server #1 IP>/{R:1}
令人驚訝的是,這有效。
我想使用 IIS ipSecurity 創建拒絕規則來阻止各種 IP 地址(窮人的防火牆)的重寫規則。 我嘗試將拒絕規則添加到 applicationHost.config 的 ipSecurity 部分,如下所示:
<ipSecurity allowUnlisted="true"> <add ipAddress="1.0.0.0" su.netMask="8" allowed="false" /> </ipSecurity>
重寫規則仍在為我拒絕的 IP 地址觸發,所以我懷疑 IIS 在 ipSecurity 之前處理重寫。
有沒有辦法配置 IIS 重寫,使其遵守 ipSecurity 中的拒絕規則?
您可以嘗試在規則中添加一個條件,通過讀取服務器變量 {HTTP_HOST} 來檢索主機 header 值,將其與模式“domain_A.com”進行匹配,然后否定匹配結果。
<rule name="Fail bad requests">
<match url=".*"/>
<conditions>
<add input="{HTTP_HOST}" pattern="domain_A.com" negate="true" />
</conditions>
<action type="AbortRequest" />
</rule>
更多信息您可以參考此鏈接: 創建訪問阻止規則。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.