Welcome Guest, Not a member yet? Register   Sign In
Codeigniter IP Detection Incomplete
#1

[eluser]Unknown[/eluser]
I wasn't sure if this would be considered a bug, but it's something that I'm surprised I ran into.

One of my webhosts is currently setup running haproxy to load balance requests between two separate web servers. When using the Codeigniter session library, all sessions are stored with the client's IP address as 10.1.1.1 which is returned by $_SERVER['REMOTE_ADDR']. Obviously, this is not what is to be expected to be stored with a session.

To get a more accurate IP address, Codeigniter should be checking HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, HTTP_X_FORWARDED, HTTP_X_CLUSTER_CLIENT_IP, HTTP_FORWARDED_FOR, HTTP_FORWARDED, and finally, REMOTE_ADDR.




Theme © iAndrew 2016 - Forum software by © MyBB