使用 IIS 和 ISAPI 重写强制使用 HTTPS

发布于 2024-09-15 17:13:10 字数 678 浏览 1 评论 0原文

我正在努力强制使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月下凄凉 2024-09-22 17:13:10

如果页面是从 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's onRequestStart(). Pure CFML solution that would work across all web servers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文