Ssl 强制使用HTTPS将页面重定向到http://http/ 网址
我已将此代码添加到Ssl 强制使用HTTPS将页面重定向到http://http/ 网址,ssl,redirect,iis,web-config,orchardcms,Ssl,Redirect,Iis,Web Config,Orchardcms,我已将此代码添加到web.config文件的Configuration->system.webServer部分,以强制用户使用https: <rewrite> <rules> <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add
web.config
文件的Configuration->system.webServer
部分,以强制用户使用https:
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}"
redirectType="Permanent" />
</rule>
</rules>
<outboundRules>
<rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
<match serverVariable="RESPONSE_Strict_Transport_Security"
pattern=".*" />
<conditions>
<add input="{HTTPS}" pattern="on" ignoreCase="true" />
</conditions>
<action type="Rewrite" value="max-age=31536000" />
</rule>
</outboundRules>
</rewrite>
但当我访问我的网站时,它会将页面重定向到此url:
http://http/
注:
- 我使用的是Orchard CMS版本1.10.x
- 当我使用Orchard的SSL插件强制所有页面使用SSL时,这种情况再次发生
- 在Orchard的设置中启用SSL重定向
- 在我的Plesk控制面板中正确设置了SSL/TLS证书
- 网站目前使用“Let's Encrypt”进行安全保护。当我也使用Cloudflare服务时,就会出现此问题
- 这在我测试过的每个web浏览器上都会发生
如果您想使用Orchard插件,请删除您的重写规则,改为使用该插件。我使用相同的重写规则在Plesk面板上使用Orchard将页面重定向到https,并使用Let's Encrypt certificates。此规则将每个http调用重定向到https。 您必须禁用Orchard安全套接字层插件,因为您在web.config中制定了自己的规则。
如果您想使用Orchard插件,请删除重写规则,改为使用该插件。我尝试了这两种方法。首先,我禁用了SSL插件并使用了上面的代码片段。然后启用了SSL插件并删除了代码段,但在这两种情况下仍然存在相同的问题。首先,我禁用了SSL插件并使用了上面的代码片段。然后启用SSL插件并删除代码段,但在这两种情况下仍然存在相同的问题。