HTTP_X_REAL_IP

$_SERVER['REMOTE_ADDR'];Get the address of the server

$_SERVER['HTTP_X_REAL_IP'];Get the address of the client In

nginx proxy mode, get the real IP of the client
and set it in nginx:

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; The

backend program can obtain the user's ip address from the Server variables HTTP_X_REAL_IP and HTTP_X_FORWARDED_FOR.

The value of HTTP_X_REAL_IP is the user REMOTE_ADDR

reference address obtained by nginx: http://doubao.javaeye.com/blog/427619

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326990688&siteId=291194637