Support » Plugin: WP fail2ban » Support for X-Forwarded-For

  • Resolved litemotiv


    Since REMOTE_ADDR is only available for direct connections and not on proxies, could you perhaps add support for X_FORWARDED_FOR headers? Something like below would work:

    function($user_login, $user)
        $ip = ($_SERVER['REMOTE_ADDR'] != '') ? $_SERVER['REMOTE_ADDR'] : $_SERVER['X_FORWARDED_FOR'];
        syslog(LOG_INFO,"Accepted password for $user_login from {$ip}");

    Thanks. 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • Where you add this code ?

    tks i founded

    very useful, I hope this works as intended and can be incorporated into the next plugin version please?

    Plugin Author invisnet


    I’ve just released 2.0.0 which has some *experimental* code to handle this; it’s a little different from what you’ve done but the principle is the same.
    Details are in the readme – let me know how you get on.

    Going to check this out soon! Thanks for following up!

    jsut read the readme and you say:

    so don’t add whitespace or CIDR notations

    but what I need this for is for the CloudFlare IPs and they only specify them in CIDR format =>

    Any chance you could add CIDR support?

    Plugin Author invisnet


    Sorry for the delay in mentioning it, but the latest release now has support for CIDR.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Support for X-Forwarded-For’ is closed to new replies.