我使用Url Rewrite模块和ARR 3将IIS配置为反向代理 . 我有一个公共域,它在localhost上重定向到我的应用程序 . 当应用程序重定向到另一台主机时,它工作正常 . 即:重定向到“https://www.google.com/search?q=url+rewrite+iis+arr+3 " My browser shows " 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>
1 回答
感谢IIS.net论坛上的milope(不知道我是否可以发布链接)给我以下解决方案:
这对我有用,解决了我的重定向问题 .