Form Tools
CloudFlare: Getting original IP address of the visitor - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: Feature Suggestions (https://forums.formtools.org/forumdisplay.php?fid=7)
+--- Thread: CloudFlare: Getting original IP address of the visitor (/showthread.php?tid=1532)



CloudFlare: Getting original IP address of the visitor - xoxo - Aug 14th, 2011

Hello!

I have a suggestion, if it is possible.

Do you know CloudFlare? It's an amazing service for making your websites faster and more secure. I have been using their free service for a while, and I'm really happy.

The problem is that when I try to use CloudFlare with a domain that hosts a FormTools form, which is getting the original IP of visitor, what happens is that always arrives the CloudFlare IP and there is no way to obtain the original one.

After asking CloudFlare support, making the change in VPS and dedicated is easy, but in a shared environment, some changes must be done.

Feel free to check this wiki document:

http://www.cloudflare.com/wiki/Log_Files

Hope there is an easy workaround for this. Thank you!!
For example, there is a Wordpress module:

http://wordpress.org/extend/plugins/cloudflare/


RE: CloudFlare: Getting original IP address of the visitor - Mark - Aug 30th, 2011

We also use CloudFlare and also have this problem.

- Mark


RE: CloudFlare: Getting original IP address of the visitor - Ben - Aug 31st, 2011

Hey guys,

Huh, I'd never heard of CloudFare. Interesting service.

I guess the Apache re-write option they suggest isn't possible in your cases? I'll take a look at one of the PHP app code to see what they're doing to extract the correct IP. If it's not too difficult, maybe I could put something together.

- Ben


RE: CloudFlare: Getting original IP address of the visitor - Ben - Aug 31st, 2011

Hey guys,

Mind trying a quick thing?

Add this line to your config.php file:

PHP Code:
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"] ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"]; 

From what I've *read*, Cloudflare passes the original users' IP address via the HTTP_CF_CONNECTING_IP header, so that should fix it for Form Tools.

That said, I quickly tried setting it up on one of my own domains and didn't see the header that I expected.

Still, give it a go and let me know. It won't cause any problems if it doesn't work.

- Ben




RE: CloudFlare: Getting original IP address of the visitor - davidpham - Jun 29th, 2014

You may look at more detail instruction here http://wp2x.com/get-cloudflare-visitor-ips-php/


RE: CloudFlare: Getting original IP address of the visitor - Joe - Jul 3rd, 2014

Thanks David!

Cheers,

Joe


RE: CloudFlare: Getting original IP address of the visitor - qkru45 - Mar 19th, 2015

I'll take a look at one of the PHP app code to see what they're doing to extract the correct IP. If it's not too difficult, maybe I could put something together.???


RE: CloudFlare: Getting original IP address of the visitor - JettCarCooling - Jan 14th, 2020

Recreation of the thing and mode is applied for the chunks for the field. The ascertainment of the essaywriter.org reviews is marked for the fulfillment of the goals. Zone is suggested for the motives. Manner is defined in the clues for the paths. the skills are reformed for the methods for the structures. the path is issued for the management of the seed production for the vital paths for students.