【发布时间】:2016-03-16 05:03:37
【问题描述】:
有没有办法将 IIS 的出站重写规则限定为仅在请求的 URL 匹配模式时才应用?我怀疑这是不可能的,因为请求 URL 在响应中不可见,但我想我会问,希望它是可能的。
这是我当前的出站规则:
<rewrite>
<outboundRules>
<rule name="Change Absolute Paths" preCondition="ResponseIsHtml1">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://blog.mycompany.com/blog(.*)$" />
<action type="Rewrite" value="https://www.mycompany.com/blog{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
如果我可以在其中添加一个条件,这样出站规则仅适用于请求 URL 匹配模式时,那就太好了。
【问题讨论】: