Getting real IP behind a Proxy |
My site is behind the cloudproxy firewall from Securi.net
Using $ip = $this->input->ip_address() does not give me the real IP of visitors or myself. I know that using that code is supposed to give the real IP from behind proxys, but it doesnt seem to do so. Is there a work around for this that is secure? Or am I stuck with this? I have read several threads here, and there doesnt seem to be a valid work around. Thank you
With further reading, I am finding this is just about impossible
So I will refer this question to the cloudproxy firewall hosts and see if they can allow me to get the real addresses. Thank you for reading
The x-forwarded-host header might help, if that is forwarded by cloudproxy ...
https://developer.mozilla.org/en-US/docs...arded-Host
I have Cloudflare in front of my site. Setting Cloudfront IP addresses to config.php file as $config['proxy_ips'] helped to get the real IP addresses of the user. Easy peasy.
One way to retrieve real ip is to put this code on initialization(I used this for Cloudflare)
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $xffaddrs = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']); $_SERVER['REMOTE_ADDR'] = $xffaddrs[0]; }
So far I have the firewall IP, and the remote IP. Thats all I can get. Both lock me out of my admin once I put it in the config. Other than that, I have no idea what to put in the config ip proxy setting
I tried to get the forwarded for ip, nothing. I put the below in, and got remote. I know its not secure and didnt leave it in Code: if (!empty($_SERVER["HTTP_CLIENT_IP"]))
I found this not sure if it will help:
PHP Code: if (isset($_SERVER['HTTP_X_SUCURI_CLIENTIP'])) What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
If you would simply check $_SERVER and all HTTP headers, you'd probably see what you need. It looks like InsiteFX has your answer.
|
Welcome Guest, Not a member yet? Register Sign In |