使用 IIS 和 ISAPI 重写强制使用 HTTPS
我正在努力强制使用 HTTPS,如果用户使用 HTTP,则重定向用户。由于某种原因,我的重写规则在我的产品环境中效果很好,但在我的开发人员上效果不佳,如下所示:
# Redirect HTTP to HTTPS# redirect all http requests to https
RewriteCond %HTTPS (?!on).*
RewriteCond Host: (.*)
RewriteRule (.*) https\://$1$2 [I,RP]
在产品上,它效果很好,它会重定向用户。在开发中,它没有显示这个非常奇怪的页面:
-cache
Content-Type: text/html
Content-Length: 161
Location: https://blahblah.mainblah.com/
<html><body>The requested resource was moved. It could be found here: <a href="https://blahblah.mainblah.com/">https://dev-notebox.intuit.com/</a></body></html>
有没有人看到过这个或者对这里发生的事情有任何想法/指示?
谢谢
I'm working to force HTTPS, and if the user is on HTTP, redirect the user. For some reason My rewrite rule works great on my prod env but not my dev, here it is:
# Redirect HTTP to HTTPS# redirect all http requests to https
RewriteCond %HTTPS (?!on).*
RewriteCond Host: (.*)
RewriteRule (.*) https\://$1$2 [I,RP]
On Prod it works great, it redirects the user. On Dev, it does not but shows this very strange page:
-cache
Content-Type: text/html
Content-Length: 161
Location: https://blahblah.mainblah.com/
<html><body>The requested resource was moved. It could be found here: <a href="https://blahblah.mainblah.com/">https://dev-notebox.intuit.com/</a></body></html>
Has anyone seen this or have any ideas/pointers on what's going on here?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果页面是从 http 请求的,则可以使用
而不是使用重写。检查 Application.cfc 的onRequestStart()
中的 CGI 范围。纯 CFML 解决方案可在所有 Web 服务器上运行。Instead of using rewrite, you can use
<cflocation>
if the page is requested from http. Check CGI scope in Application.cfc'sonRequestStart()
. Pure CFML solution that would work across all web servers.