【问题标题】:Redir to HTTPS in IIS 8.0 going weird if HTTP://如果 HTTP://,则在 IIS 8.0 中重定向到 HTTPS 会很奇怪
【发布时间】:2017-07-12 19:08:22
【问题描述】:

我有一个在 IIS 8.0 下运行的 ASP.net 网站。基本 URL 是 https://www.example.com。 (证书已为 www.example.com 正确安装并且工作正常)

本网站的绑定是

  • www.example.com 端口 80
  • www.example.com 端口 443
  • example.com 端口 80

web.config 中的第一个重写规则是

<rule name="Redirect to HTTPS" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTPS}" pattern="^OFF$" />
    </conditions>
    <action type="Redirect" url="https://www.example.com/{R:1}" redirectType="Permanent" />
</rule>

网址https://www.example.com 完美运行。 URL http://www.example.com 正确重定向。 URL example.com 重定向正确。

我的问题是:如果我尝试http://example.com,我会得到一个空白页(只包含 &lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;)

提前感谢您的帮助。

问候,

男人

【问题讨论】:

  • 您的 web.config 中是否还有其他重写规则?因为我检查了你的规则,它运行良好

标签: asp.net iis url-rewriting


【解决方案1】:

错误出现在 DNS 中:example.com 的 2 个 A 记录。其中一个指向一个禁用的以前的主机。

【讨论】:

    猜你喜欢
    • 2019-09-03
    • 2013-05-02
    • 1970-01-01
    • 2021-06-26
    • 1970-01-01
    • 2011-09-16
    • 1970-01-01
    • 2018-01-18
    • 1970-01-01
    相关资源
    最近更新 更多