Last modified: 2005-09-18 12:09:17 UTC
It appears that the IP address logging for anonymous users and appearing in things like the history page is potentially using Proxy web server IP addresses and not the actual source IP address. Many ISPs now use transparent proxy servers to save bandwidth with the effect that this IP may be shared by a large number of more or less temporary users. Properly configured Proxies should pass back headers indicating the source IP and this should be captured and used. Typically this will be in the HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP headers.
we cannot blindly trust X-F-F or any other client-supplied header. every legitimate ISP proxy would have to be verified and added by hand as well as maintained as each ISP's topology changes. i'm not sure this is feasible...
This simple section of PHP gets a users IP address every time. Whether there is a cache server, proxy server or anything else. function getip() { if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) $ip = getenv("HTTP_CLIENT_IP"); else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) $ip = getenv("REMOTE_ADDR"); else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) $ip = $_SERVER['REMOTE_ADDR']; else $ip = "unknown"; return($ip); } It has never gone wrong at all.
See also bug 2856. *** This bug has been marked as a duplicate of 843 ***