ip=request.headers['X-Forwarded-For']

#nginx

proxy_pass http://127.0.0.1:5000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set $Real $http_x_forwarded_for;
if ( $Real ~ (\d+)\.(\d+)\.(\d+)\.(\d+),(.*) ){
    set $Real $1.$2.$3.$4;
}
proxy_set_header X-Real-Ip $Real;
proxy_redirect off;

发表评论

您的电子邮箱地址不会被公开。

Captcha Code