Support » Plugin: Secure Admin IP » Cannot access WP under VPN

  • Resolved toshiharu2020

    (@toshiharu2020)


    When make SECURE ADMIN IP active, cannot access WP under VPN.
    I found mistake in getUserIp function.
    Sometimes HTTP_X_FORWARDED_FOR has IP list which separated with comma.
    It does not seem to be considered.
    How about that changes as follows?

    public function getUserIp()
    {
    $ip_sources = [‘REMOTE_ADDR’, ‘HTTP_CF_CONNECTING_IP’, ‘HTTP_X_FORWARDED_FOR’, ‘HTTP_CLIENT_IP’];

    foreach ($ip_sources as $ip_source) {
    if (isset($_SERVER[$ip_source])) {
    $ip_ary = explode(‘,’,$_SERVER[$ip_source]);
    $ip = $ip_ary[0];
    $this->user_ip = filter_var($ip, FILTER_VALIDATE_IP);
    }
    }
    }

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot access WP under VPN’ is closed to new replies.