Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
2.4k views
in Q2A Core by
So I am using two proxys before my website - CloudFlare and Varnish. CloudFlare passes the IP of user accessing the site via a HTTP header variable which I capture on Varnish and can use. But am not sure how to get it to be used by q2a installation. RIght now all am seeing for IP address of any visitor is 127.0.0.1 - understandably that's the IP of my varnish installation.
by
I used this method to get real IPs from cloudflare:
$_SERVER['HTTP_CF_CONNECTING_IP']
more:
http://www.question2answer.org/qa/17543/is-q2a-compatible-with-cloudflare?show=17564#a17564

1 Answer

+2 votes
by
selected by
 
Best answer

I've never done it, but I think it should be done at the webserver level, so that you have not to modify the q2a php code.

Have a look here

If you use Apache

http://theyusedtocallitablog.net/2011/07/configuring-varnish-and-apache-to-pass-the-original-client-ip-specifically-with-wordpress-comments-in-mind/

if you have Nginx :

http://danielmiessler.com/blog/getting-real-ip-addresses-using-cloudflare-nginx-and-varnish

by
Thank you. I use NGINX and that tutorial solved the issue!
by
glad to hear it, great !
...