[英]IIS Url Rewrite ARR issue
我使用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 “失败
托管的应用程序使用Asp Net Mvc和framework.net 4.5。 该应用程序正在使用IIS应用程序池配置中的集成管道。
使用Fiddler,我可以看到以下有关redirect的跟踪:
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>
感谢IIS.net论坛上的milope(不知道是否可以发布链接)为我提供以下解决方案:
在服务器级别的“应用程序请求路由缓存”功能中,有一个链接显示为:“服务器代理设置”或类似内容。 检查是否在“代理服务器设置”中选中了响应标头中的“反向重写主机”。 如果是这样,这可能就是为什么外部链接转到本地主机的原因。
这为我工作,并解决了我的重定向问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.