Here is a fix for vbulleting forum sites which have installed apache with nginx proxy on the server,
without this fix all users of the site will have the same ip (the ip of the server the site installed at)
the problem can appear if you set timeout limit of 15 minutes after several login fails, this will cause that users who login with correct username and password will receive an error message like: You have used up your failed login quota! Please wait 15 minutes before trying again.
so here is a fix:
open includes/class_core.php with your editor and replace functions fetch_ip()
and fetch_alt_ip()
by this:
i have simpy added the $_SERVER["HTTP_X_REAL_IP"] to both functions because thi is the enviroment variable which shows the correct user ip in nginx
after i fixed mine i found a similar article here: http://wiki.unixcraft.com/display/~g...+load+balancer
without this fix all users of the site will have the same ip (the ip of the server the site installed at)
the problem can appear if you set timeout limit of 15 minutes after several login fails, this will cause that users who login with correct username and password will receive an error message like: You have used up your failed login quota! Please wait 15 minutes before trying again.
so here is a fix:
open includes/class_core.php with your editor and replace functions fetch_ip()
and fetch_alt_ip()
by this:
PHP Code:
function fetch_ip()
{
if(isset($_SERVER["HTTP_X_REAL_IP"]))return $_SERVER["HTTP_X_REAL_IP"];
else return $_SERVER['REMOTE_ADDR'];
}
function fetch_alt_ip()
{
if(isset($_SERVER["HTTP_X_REAL_IP"]))$alt_ip = $_SERVER["HTTP_X_REAL_IP"];
else $alt_ip = $_SERVER['REMOTE_ADDR']; #$alt_ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_CLIENT_IP']))
{
$alt_ip = $_SERVER['HTTP_CLIENT_IP'];
}
else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches))
{
// make sure we dont pick up an internal IP defined by RFC1918
foreach ($matches[0] AS $ip)
{
if (!preg_match('#^(10|172\.16|192\.168)\.#', $ip))
{
$alt_ip = $ip;
break;
}
}
}
else if (isset($_SERVER['HTTP_FROM']))
{
$alt_ip = $_SERVER['HTTP_FROM'];
}
return $alt_ip;
}
i have simpy added the $_SERVER["HTTP_X_REAL_IP"] to both functions because thi is the enviroment variable which shows the correct user ip in nginx
after i fixed mine i found a similar article here: http://wiki.unixcraft.com/display/~g...+load+balancer
Comment