Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Proxy Ip reported instead of User Ip #907

aeperezt opened this Issue · 1 comment

2 participants


When behind a loadbalance (rackspace on this case) the HTTP_X_FORWARDED_FOR variable is not reported properlly so I get the load balancer Ip instead if the user Ip changer the HTTP_X_FORWARDED_FOR to HTTP_X_CLUSTER_CLIENT_IP solved issue. Think you should include HTTP_X_CLUSTER_CLIENT_IP as one of the options for future cases.

if (config_item('proxy_ips') != '' && $this->server('HTTP_X_CLUSTER_CLIENT_IP') && $this->server('REMOTE_ADDR'))

                    $proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY);
                    $proxies = is_array($proxies) ? $proxies : array($proxies);
                    $this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] : $_SERVER['REMOTE_ADDR'];
            elseif ($this->server('REMOTE_ADDR') AND $this->server('HTTP_CLIENT_IP'))
                    $this->ip_address = $_SERVER['HTTP_CLIENT_IP'];
            elseif ($this->server('REMOTE_ADDR'))
                    $this->ip_address = $_SERVER['REMOTE_ADDR'];
            elseif ($this->server('HTTP_CLIENT_IP'))
                    $this->ip_address = $_SERVER['HTTP_CLIENT_IP'];
            elseif ($this->server('HTTP_X_CLUSTER_CLIENT_IP'))
                    $this->ip_address = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
@narfbg narfbg referenced this issue from a commit
@narfbg narfbg Fix issues #227 and #907 b0fe0a9
@narfbg narfbg closed this
@sviande sviande referenced this issue from a commit in sviande/CodeIgniter
@narfbg narfbg Fix issues #227 and #907 a3cbba2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.