By Dreamonde Limited / Alfred Tang on Friday, 18 April 2014
Replies 10
Likes 0
Views 774
Votes 0
Hi Team,

Member's Map is a great feature to understand their member's location (from backend - ES dashboard) visually. However, I found this doesn't work while "fronting" the website "behind" a CDN, such as Cloudflare. Not sure if your team have any roadmap to support this in future? I know Cloudflare will supply the IP via HTTP_CF_CONNECTING_IP header; and may fix all siteowner's still can view their member's map correctly behind CDN or at least Cloudflare.

If this is not your interest, maybe can somebody guide me where to modify to implement below codes (or your codes) for ES to retrieve correct IP location behind CDN services.

At least I will try this today myself and see if I can do something via the fixing webserver, and share the result (if possible to avoid modifying ES):
https://support.cloudflare.com/hc/en-us/articles/200170916-Why-should-I-install-mod-cloudflare-
https://support.cloudflare.com/hc/en-us/articles/200170836-How-do-I-restore-original-visitor-IP-to-Apache-Web-Servers-

I have some sharing from internet and this may shorten your development time just in case.

Add this line to your 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.

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.


Thanks

Best regards,
Alfred / Dreamonde
Hello Alfred,

EasySocial does not determine the client's ip address. It actually determines the location of the user based on their custom fields When a user saves their profile, EasySocial will geocode the address and store the latitude and longitude that they have provided.
·
Saturday, 19 April 2014 01:34
·
0 Likes
·
0 Votes
·
0 Comments
·
More sharing for how CloudFlare handling HTTP headers:

https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-CloudFlare-handle-HTTP-Request-headers-

If ES can pickup "X-Forwarded-For: [X.X.X.X,Y.Y.Y.Y,]A.B.C.D" for IP Member's map location, then it's the best result as no need to install anything on server side (some people using shared server services or lack of server mgt experiences), good for all newbies (like me:D ) running ES.
·
Friday, 18 April 2014 12:20
·
0 Likes
·
0 Votes
·
0 Comments
·
I also found this for Joomla, not sure if it works also.

https://www.cloudflare.com/resources-downloads
·
Friday, 18 April 2014 12:31
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Team,

I've installed the mod_cloudflare for my apache and confirmed my real IP is captured/logged in Apache's log and visible to PHP, but I still cannot see the ES member's map showing my correct location, please advise. Thanks.

p.s. I also installed this Joomla plugin still no luck,
http://extensions.joomla.org/extensions/site-management/content-networking/16320

Best regards,
Alfred /Dreamonde
·
Friday, 18 April 2014 12:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Alfred,

EasySocial actually supports Cloudflare out of the box automatically. You just need to set the CDN url in the settings at the back end of EasySocial. Am I missing anything here?
·
Friday, 18 April 2014 13:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

I think it's a bit different form Cloudflare CDN as they don't provide a "url" for my services, and I don't use their Rocket Launcher function at the moment as I want the browser still to control what sequences for items to pull in. Anyway here is my current setting and please advise if anything still missing. and the map showing I am now in US (which I am actually in Taiwan).

Best regards,
Alfred
·
Friday, 18 April 2014 13:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, I am not sure what type of Cloudflare CDN setup you have but in general, most customers who has Cloudflare, would be given a URL that they can use to load assets / js / css files through Cloudflare. Hence, on the settings page you can specify the cloud flare URL.
·
Friday, 18 April 2014 17:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

to my understanding, Cloudflare is no longer an asset based CDN. Since they will act as a DNS server to "front" all request and redirect all resources, cache, and request to save bandwidth automatically. I can say the whole website will be cache intelligently without bordering asset files, scripts, and dynamic contents. (Sure client still have chance to choose any exclusion and cache level,etc) If so, I guess I can put my main website to the CDN url to try but I guess this will not solve my problem as this is just like no-CDN at all and ES will still recognize traffic from CDN network as client's traffic; even Cloudflare already declared that is a re-direct traffic.

I just wonder how ES determine client's IP since I can sure that the web-server already have the correct "client ip" after installing the mod_cloudclare.

reference : http://www.cloudflare.com/features-cdn

Best regards,
Alfred
·
Friday, 18 April 2014 19:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

The mystery unrevealed. ^.^ Sorry I didn't read the doc about this part. Anyway, I am looking for the Google map enhanced version for address field soon. Thanks.

Best regards, Alfred
·
Sunday, 20 April 2014 21:54
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome Alfred
·
Sunday, 20 April 2014 22:14
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post