![]() |
Getting real IP behind a Proxy - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Getting real IP behind a Proxy (/showthread.php?tid=69099) Pages:
1
2
|
Getting real IP behind a Proxy - BradVH - 10-08-2017 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 RE: Getting real IP behind a Proxy - BradVH - 10-08-2017 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 RE: Getting real IP behind a Proxy - ciadmin - 10-08-2017 The x-forwarded-host header might help, if that is forwarded by cloudproxy ... https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host RE: Getting real IP behind a Proxy - fobin - 10-08-2017 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. RE: Getting real IP behind a Proxy - ash-f - 10-08-2017 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]; } RE: Getting real IP behind a Proxy - BradVH - 10-08-2017 Thanks folks, will try your suggestions! RE: Getting real IP behind a Proxy - BradVH - 10-08-2017 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"])) RE: Getting real IP behind a Proxy - InsiteFX - 10-09-2017 I found this not sure if it will help: PHP Code: if (isset($_SERVER['HTTP_X_SUCURI_CLIENTIP'])) RE: Getting real IP behind a Proxy - skunkbad - 10-09-2017 If you would simply check $_SERVER and all HTTP headers, you'd probably see what you need. It looks like InsiteFX has your answer. RE: Getting real IP behind a Proxy - BradVH - 10-09-2017 Thank you InsiteFX, will try it |