Nginx – Show original ip with cloudflare

cloudflarenginx

I installed nginx and the HttpRealipModule to get the original ip of my visitors.I also add this in the http{ } part in my nginx.conf

  set_real_ip_from   204.93.240.0/24;
  set_real_ip_from   204.93.177.0/24;
  set_real_ip_from   199.27.128.0/21;
  set_real_ip_from   173.245.48.0/20;
  set_real_ip_from   103.22.200.0/22;
  set_real_ip_from   141.101.64.0/18;
  set_real_ip_from   108.162.192.0/18;
  set_real_ip_from   190.93.240.0/20;
  real_ip_header     CF-Connecting-IP;

However when i do

netstat -atun | awk '{print $5}' | cut -d: -f1 | sed -e '/^$/d' |sort | uniq -c | sort -n

To find out the ip address of my visitors , all the ip i get has ISP as Cloudflare(i traced those ip)
Any idea why its not showing the original ip

-Some other question
I want to limit the number of concurrent connections people use while downloading from my site.If i use limit_conn 4; it will do the job but if user is downloading and try to access site from browser he/she get 503 unavailable.Is there a way to limit connections but still allow users to view site simultaneously

Best Answer

You're not seeing the web browser's IP address from netstat because the connections are coming from CloudFlare. This is how CloudFlare works.

To see the IP addresses you need to look at your nginx logs.