【发布时间】:2015-10-01 19:16:37
【问题描述】:
我正在尝试从以下位置重定向托管在 Azure 上的 MVC 网站: https://domain.com 到 https://www.domain.com
domain.com 重定向到https://www.domain.com
http://domain.com 重定向到https://www.domain.com
但由于某种原因https://domain.com 不会。它在 chrome 中给出了“此网页不可用”“ERR_CONNECTION_REFUSED”。
我在我的 webconfig 中使用以下规则强制使用 HTTPS:
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
我已经看到一些关于 apache 的答案,但这是作为 Azure 网站托管的。
【问题讨论】:
-
检查规则的顺序。此外,最好通过您的 DNS 注册商将根转发到 www。
标签: asp.net-mvc azure redirect