Only local ip is recorded
-
WP-Statistics records the server’s ip for all visitors instead of the remote ip.
After some debugging, I figured out, that wp-statistics in it’s get_IP() method prefers to take the value of $_SERVER[‘HTTP_X_FORWARDED_FOR’] over $_SERVER[‘REMOTE_ADDR’].
For some reason, our provider (Bluehost.com) stores the server’s address in HTTP_X_FORWARDED_FOR. The client’s addres is only in REMOTE_ADDR.
The plugin should probably check whether the value in HTTP_X_FORWARDED_FOR is the server’s address and only take it if it is actually a foreign address. Alternatively, it might make sense to offer a setting for the user to choose where to take the remote address from.
As a workaround, I added the following two lines at the beginning of wp-config.php
unset($_SERVER[‘HTTP_X_FORWARDED_FOR’]);
putenv(‘HTTP_X_FORWARDED_FOR’);Thus, while this solves the issue for me, you might want to consider to put a workaround into the plugin, especially since Bluehost ist getting quite popular these days.
- The topic ‘Only local ip is recorded’ is closed to new replies.