• Resolved kaymes

    (@kaymes)


    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.

Viewing 1 replies (of 1 total)
  • DediData

    (@dedidata)

    Hi Friend,

    https://en.wikipedia.org/wiki/X-Forwarded-For :
    The X-Forwarded-For (XFF) HTTP header field is a common method for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer.

    So X-Forwarded-For is a way for forwarding client IP address, Not server IP address
    It uses when a server is behind a proxy

    But we try to add an option for this matter, which you can be able to prevent preferring X-Forwarded-For over REMOTE_ADDR

    if you have any other problem, please change the status of this support request to “not resolved”

    Regards

Viewing 1 replies (of 1 total)
  • The topic ‘Only local ip is recorded’ is closed to new replies.