• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Cloudflare & IP checking

Caelum

Well-known member
#1
Yeah, basically, I've been using Cloudflare for a while now, and liking it. Trouble is, because it fuctions as a reverse proxy of sorts, all IPs come from Cloudflare's servers. That is, when I check a user's IP, the only IP that's been recorded will be one of Cloudflare's. Which doesn't particularly help when IP banning. :p

Long story short, if anyone could fix up a quick XF mod that fixes that, I'd love you to death (in a non-creepy, platonic, non-fatal sort of way). Essentially, something like this, except for XF.

Thanks ;)
 

James

Well-known member
#3
I think from the top of my head that the quick fix was to put this into config.php:

Code:
if($_SERVER['HTTP_CF_CONNECTING_IP']){
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
 
#4
@James,

I, like many people, really dont understand exactly what that snip of coding does. Could you explain what it does or how to use it? Do you add known ip's in it somewhere? Just looking at it as is really creates more confusion for me than it does solutions.

Thanks,
Steve
 

James

Well-known member
#5
When a visitor connects to your server, it shows that they are connecting via Cloudflare's servers because of the way Cloudflare works. Because of this, Cloudflare sends the user's IP address in a header when they connect, allowing you to use it.

This snippet of code checks if there's an IP in the header (HTTP_CF_CONNECTING_IP) and if there is, it assigns their IP address to the standard IP variable (REMOTE_ADDR) so that your software can show their actual IP and not the IP of Cloudflare's servers.
 
#9
I gather if your using it, that cloudflare must make a noticeable speed difference.

Are there any Negatives to using Cloudflare?
 

Caelum

Well-known member
#10
I gather if your using it, that cloudflare must make a noticeable speed difference.

Are there any Negatives to using Cloudflare?
Not really. There's false positives in their threat detection, but people can be whitelisted & it's possible to have your security settings so low no false positives occur anyway.
If you were already using another CDN, using Cloudflare would probably be excessive, but other than that, no drawbacks I can think of. ;)