http 到 https 重写太多重定向循环 IIS 7 [英] http to https rewrite too many redirect loops IIS 7
问题描述
我有我在 IIS 7.0 中托管的应用程序.我必须确保它仅适用于 HTTPS 而不适用于 HTTP所以我在我的根配置中包含了以下规则.
I have application which I have hosted in IIS 7.0. Where I have to make sure that it works only on HTTPS and not on HTTP so I have included below rule in my root config.
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
</rule>
</rules>
</rewrite>
在我尝试访问我的应用程序时添加此规则后,出现以下错误:
After adding this rule when i tried to access my application I get below error:
页面导致了过多的重定向.清除您的 cookie本网站或允许第三方 cookie 可能会解决问题.如果不,这可能是服务器配置问题,而不是你的电脑.以下是一些建议: 稍后重新加载此网页.详细了解此问题.
Page has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. Here are some suggestions: Reload this web page later. Learn more about this problem.
推荐答案
放入以下输入条件:
<add input="{HTTPS}" pattern="on" />
代替:
<add input="{HTTPS}" pattern="off" />
这篇关于http 到 https 重写太多重定向循环 IIS 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!