Getclicky showing proxy ip
Hey all,
I’ve been trying to track the visitor ip to see what the visitor did on the website, before he submitted a message via the contact form.
I’m using this url to track that:
http://getclicky.com/stats/visitors?site_id=XXXXX&ip_address=[wpcf7.remote_ip]
The [wpcf7.remote_ip] part is from contact form 7, see http://contactform7.com/2009/12/25/special-mail-tags/
Problem is that it’s not taking the actual visitor ip, just the one that is setup for hosting.
If I check this page: http://getclicky.com/stats/visitors?site_id=XXXXX I see the visitors IP, so it does record the ip of the visitors.
Does anyone here have any suggestions to solve this issue?
Thanks a lot.
Posted Mon Apr 12 2010 10:06a by rjank***
What is the IP that contactform7 is showing? If it's an "internal" IP (192.168.x.x or 10.x.x.x) then we ignore that and use their router/proxy external IP.
Posted Mon Apr 12 2010 11:04a by Your Friendly Clicky Admin
It’s showing 192.168.x.x which is our own proxy IP.
If I check the visitors page, I do however see that its logging their original IPs.
Is there a code or something I can add, so it grabs the real IP?
Posted Mon Apr 12 2010 11:14a by rjank***
Since the problem is with the third party product, please contact them.
Posted Mon Apr 12 2010 12:18p by Your Friendly Clicky Admin
Thanks for your support.
Do you happen to know of a way to track the IP via the x-forwarded-for?
Posted Tue Apr 13 2010 6:45a by rjank***
Yes, in fact here is the exact code that Clicky uses (minus one thing that is specific to our load balancer software):
if( $_SERVER['HTTP_X_FORWARDED_FOR'] && !preg_match( "#^(10.|192.168.|127.0.0.1|172.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31).)#", $_SERVER['HTTP_X_FORWARDED_FOR'] )) {
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else $ip_address = $_SERVER['REMOTE_ADDR'];
x-forwarded-for can still contain internal IPs which is why we have a regular expression to check for all "valid" internal IP values, so if it matches one of those it's ignored.
Posted Tue Apr 13 2010 10:02a by Your Friendly Clicky Admin
Heh, there are a bunch of backslashes that got stripped out there. Basically before every "." character in the regular expression, there should be a backslash right before it.
Posted Tue Apr 13 2010 10:03a by Your Friendly Clicky Admin
You must be
logged in to your account to post!