且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在没有任何 SSL 证书的情况下将 https 重定向到 http

更新时间:2022-03-18 21:56:57

确实没有办法做到这一点:HTTPS 依赖于存在的 SSL 证书以及在将任何数据发送到服务器之前发生的 SSL 协商.因此,如果没有 SSL 证书,那么它甚至不会达到您可以发送重定向的程度(正如您所观察到的).

There is really no way to do that: HTTPS relies on the SSL certificate being present and the SSL negotiation ocurring BEFORE any data is sent to the server. Therefore if there is no SSL cert then it won't even get to the point where you can send a redirect (as you are observing).

我建议您购买最便宜的证书:GoDaddy 有特价 12.99 美元,我已经非常有效地用于此目的(Facebook 应用程序 SSL 页面),您可以在 15 分钟内购买并准备好.

I'd suggest just buying the cheapest cert you can: GoDaddy has specials for $12.99 that I've used quite effectively for just this purpose (Facebook app SSL pages) and that you can have bought and ready in 15 minutes.

只需使用 Lets Encrypt,正如@xbakesx 在他的评论中所说的那样.完全免费,没有延迟,几乎无处不在.

Just use Lets Encrypt, as @xbakesx states in his comment. Completely free, no delay, accepted pretty much everywhere.