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>
当我尝试访问我的应用程序时添加此规则后,我得到以下错误
Page has导致重定向过多。清除此网站的cookie或允许第三方cookie可以解决问题。如果没有,它可能是服务器配置问题,而不是您的计算机的问题。以下是一些建议:稍后重新加载此网页。了解有关此问题的更多信息。
After adding this rule when i tried to access my application I get below error 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屋!