As you know, the user's IP is $_SERVER['REMOTE_ADDR']
. That's it. But in some situations a server may be behind a proxy (often a load balancer), then IP will be in $_SERVER['HTTP_X_FORWARDED_FOR']
. Also it's recommended to store both values.
Ok I've two related questions:
REMOTE_ADDR
is containing what when thisHTTP_X_FORWARDED_FOR
isn't empty?What are these things(based on this answer) ? Might they be containing the IP? If yes then in that case
REMOTE_ADDR
andHTTP_X_FORWARDED_FOR
are containing what?HTTP_CLIENT_IP
HTTP_X_FORWARDED
HTTP_FORWARDED_FOR
HTTP_FORWARDED