【问题标题】:Redirect from http to https results in redirect loop从 http 重定向到 https 导致重定向循环
【发布时间】:2016-01-08 15:30:28
【问题描述】:

我想将我网站上的所有主机名重定向到 https。 我在 IIS 的 urlRewrite 中添加了以下规则:

<rule name="HTTP to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
  <add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}"
    redirectType="Permanent" />
 </rule>

但是在浏览时我得到了重定向循环。我做错了吗?

【问题讨论】:

  • 我已经检查了我的本地,上面添加的规则在我的情况下运行良好。
  • 我也看到了这个问题,但很少见。我不知道如何重现它。一些非常奇怪的事情正在发生。在 IIS 8 中似乎也是一个问题,请参阅this question

标签: https url-rewriting iis-7


【解决方案1】:

配置正确。我能看到的唯一问题是未关闭的&lt;rule&gt; 标签。

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
  <match url="(.*)" />
    <conditions>
      <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    </conditions>
  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>

【讨论】:

    猜你喜欢
    • 2015-10-09
    • 2016-06-15
    • 1970-01-01
    • 1970-01-01
    • 2018-01-18
    • 2016-11-23
    • 2019-06-16
    • 2016-03-27
    • 1970-01-01
    相关资源
    最近更新 更多