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

后端 未结 3 1299
太阳男子
太阳男子 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:29

    See the answer https://stackoverflow.com/a/19599143/1524502, and note the issues about being behind a reverse proxy or load balancer. Most likely, that is your problem.

    The answerer in that question recommended using

    request.getHeader("x-forwarded-proto")
    

    instead, though that is dependent on your load balancer setting the header correctly.

提交回复
热议问题