How can I override the default getUserIP() function so it uses the ip address if it is behind the load balancer
current
public function getUserIP()
{
return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
}
to
public function getUserIP()
{
return (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : null;
}
I dont want to modify the core default file otherwise i need to maintain my own changelog and each time I update the yii framework i have to re patch the code.