【发布时间】:2016-11-02 16:59:01
【问题描述】:
我使用 Url Rewrite 模块和 ARR 3 将 IIS 配置为反向代理。 我有一个公共域,它重定向到我在本地主机上的应用程序。 它工作正常,除非应用程序重定向到另一台主机。 即:重定向到“https://www.google.com/search?q=url+rewrite+iis+arr+3” 我的浏览器显示“http://localhost/search?q=url+rewrite+iis+arr+3” 失败了
托管应用程序正在使用带有 framework.net 4.5 的 Asp Net Mvc。 该应用程序正在使用 IIS 应用程序池配置中的集成管道。
使用 Fiddler,我可以在重定向上看到以下跟踪:
HTTP/1.1 302 Found
Cache-Control: private
Content-Length: 350
Content-Type: text/html; charset=utf-8
Location: http://localhost/search?q=url+rewrite+iis+arr+3
Server: Microsoft-IIS/7.5
X-Powered-By: ARR/3.0
X-Powered-By: ASP.NET
Date: Wed, 02 Nov 2016 16:39:18 GMT
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://www.google.com/search?q=url+rewrite+iis+arr+3">here</a>.</h2>
</body></html>
我的 IIS 配置:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost/{R:1}" />
</rule>
</rules>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="IsRedirection" stopProcessing="true">
<match filterByTags="A" pattern="^http(.*)" negate="false" />
<action type="None" />
</rule>
<preConditions>
<preCondition name="IsRedirection">
<add input="{RESPONSE_STATUS}" pattern="3[0-9][0-9]" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
【问题讨论】:
标签: url redirect iis url-rewriting arr