BR 技术头条 技术链接、资讯与社区分享流
lo log.zhoz.com / 2018-07-05 13:43 / by @技术头条

负载均衡http自动转https的实现方法


通常,http自动转https的实现方法有两种全局方式1、修改Apache2、修改.htaccess原理一样,2--5行:ServerName zhoz.com# SSLRewriteEngine OnRewriteCond %{SERVER_PORT} !^443$RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]但遇到了负载均衡服务器时,由于服务器间是通过http方式访问的,所以以上方式判断不了。用Js直接读取来处理,代码如下:<script type="text/javascript">var url = window.location.href;if (url.indexOf("https") &

赞过的人

@技术头条

发表评论