Post: Get actual IPs instead of Cloudflares (If you use their DNS + Protection)
04-11-2016, 08:10 AM #1
CyberNomadic
Web Developer
(adsbygoogle = window.adsbygoogle || []).push({}); So, one common happening is when you use anything PHP, you will get all cloudflare IPs. Then can be very annoying if you are trying to ban users or log important things.
Use this simple code in your script to eliminate that problem:
    
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}


This is not fullproof and can be bypassed!
Hope this is beneficial to some of you new guys out there!
For those using Wordpress or another type of CMS/system.. Check out their plugins. Usually someone has made a plugin to convert the IPs and doing so properly with the way the CMS is built.
Last edited by CyberNomadic ; 04-20-2016 at 12:34 AM.

The following 3 users say thank you to CyberNomadic for this useful post:

DoozyXGod, OgKillaBee187
04-15-2016, 03:46 PM #2
Octolus
I defeated!
Can be exploited, by setting the headers manually (Example if they have your server ip they can bypass CloudFlare).
04-20-2016, 12:33 AM #3
CyberNomadic
Web Developer
Originally posted by Octolus View Post
Can be exploited, by setting the headers manually (Example if they have your server ip they can bypass CloudFlare).


Never thought of that. Thanks for letting me know!

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo