首页 > 其他 > 详细

开发问题解决志

时间:2014-05-07 19:02:26      阅读:374      评论:0      收藏:0      [点我收藏+]

2014.5.5

     获取客户端真实ip地址出现问题,解答如下:

    

When you have NAT (Network Address Translation) device before your servlet container request.getRemoteAddr() returns the address of NAT , since it initiate a new connection.

To solve your problem you should configure you NAT to send in a header the IP of the original client. Then, to take the header from the request. In case you configure in NAT X-Forwarded-For header use this code: request.getHeader("X-Forwarded-For")

You function is correct, you can use it when you configure NAT.

 

   

开发问题解决志,布布扣,bubuko.com

开发问题解决志

原文:http://www.cnblogs.com/elearn007/p/3709819.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!