我记得nutz 有发过一个类似 IP138一样的页面在哪个地方?
4 回复
大佬,我用的tomcat,然后是nutz Mvc 用Lang.getIp(req)这个方法,过滤不了X-Forwarded-For伪造的IP,也过滤不了使用了代理的IP。现在的需求是必须获取客户端的真实IP。想问问你是怎么实现的!
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream tomcat_server{
server 127.0.0.1:8088;
}
server {
listen 8080;
server_name 127.0.0.1;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header HTTP_CLIENT_IP $remote_addr;
proxy_redirect off;
proxy_connect_timeout 240;
proxy_send_timeout 240;
proxy_read_timeout 240;
proxy_pass http://tomcat_server;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
添加回复
请先登陆