【问题标题】:IIS Url Rewrite ARR issueIIS URL 重写 ARR 问题
【发布时间】: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


    【解决方案1】:

    感谢 IIS.net 论坛上的 milope(不知道能否发布链接)为我提供以下解决方案:

    在服务器级应用请求路由缓存特性中,有 是一个链接,上面写着:服务器代理设置或类似的东西。 检查是否在响应头中检查了 Reverse rewrite host in response 代理设置。如果是这样,这可能就是外部链接转到 localhost 的原因。

    这对我有用并解决了我的重定向问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-18
      • 2016-11-03
      • 2019-10-26
      • 1970-01-01
      • 1970-01-01
      • 2014-10-23
      • 1970-01-01
      • 2011-10-21
      相关资源
      最近更新 更多