Cannot access WP under VPN
-
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);
}
}
}
The topic ‘Cannot access WP under VPN’ is closed to new replies.