【发布时间】:2020-02-24 18:41:21
【问题描述】:
我在我的 Asp.net MVC 网站的web.config 中有以下规则。
当我启用此规则时,它会导致 301 错误循环!
<rule name="Redirect to https" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" negate="false" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="OFF" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
用 CURL 测试网站 url without https:
注意事项
- 即使在启用规则时尝试 URL
with https,我也会得到相同的 302 错误循环。 - 我在我的网站上使用 Cloudflare SSL
您对这个问题有什么看法?问题出在哪里?
【问题讨论】:
-
@RobertHarvey,如果我尝试 URL with Https 和 Enabled rule,我会得到同样的错误,但是当我尝试 带有 Https 的 URL 和 禁用的重写规则!
-
docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/… 查看实际的请求/响应,然后应该清楚原因。
标签: asp.net-mvc iis url-rewriting iis-8