网站开发和设计实训,质量管理,建设销售型企业网站,wordpress 模板 淘宝客Java开发中使用 request.getRemoteAddr 获取客户端 ip #xff0c;返回结果始终为127.0.0.1。原因是服务器使用了nginx反向代理。
解决办法#xff1a;在nginx配置文件 nginx.conf 中添加#xff1a;proxy_set_header X-Real-IP $remote_addr; server {location ^~ /test…Java开发中使用 request.getRemoteAddr 获取客户端 ip 返回结果始终为127.0.0.1。原因是服务器使用了nginx反向代理。
解决办法在nginx配置文件 nginx.conf 中添加proxy_set_header X-Real-IP $remote_addr; server {location ^~ /testweb/ {root html;access_log on;index index.jsp;proxy_set_header X-Real-IP $remote_addr; //添加此项proxy_pass http://127.0.0.1:88/testweb/; }} java 代码如下
ip2region解析ip获取地区位置-CSDN博客