首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

关于http改成https的实现

2012-09-06 
关于http改为https的实现1:https的访问.需要证书才能够访问,加强了系统的安全性2:实现方法:只需在一个请求

关于http改为https的实现
1:https的访问.需要证书才能够访问,加强了系统的安全性
2:实现方法:
  只需在一个请求中设置成https,其它的请求页面都会转为https
  
  如:我们在登录页设置https:
  <form name="login" id="login" method="post" action="https://<%=ip%  >:<%=port%><%=path%>/tellin/portal/loginaction.action">

将action的地址改为https即可,ip一般为8043

仅仅这样做是有缺陷的.因为首次进入到登录页面,并没有转为https.所以见第3步.
3:系统一加载,就用js重定向到https
//重定向到https页面
var locaStr=window.location+'';
if(locaStr==null||locaStr.indexOf("https:")==-1)
{
    window.location="https://<%=ip%>:<%=port%>/<%=path% >/tellin/portal/reloadLogin.action";
         }

热点排行