request.getScheme() is returning http instead of returning https in java

后端 未结 3 1255
太阳男子
太阳男子 2021-02-05 18:05
function demo(request,response){
        request.getScheme() is returning http instead of returning https.
        System.out.println(\"\"+request.getScheme());
}
         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-05 18:23

    I used to have a similar problem with getScheme()

    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    

    I've solved using "//" instead:

    String basePath = "//"+request.getServerName()+":"+request.getServerPort()+path+"/";
    

提交回复
热议问题