Skip to content

Instantly share code, notes, and snippets.

@igortik
Last active August 21, 2019 22:57
Show Gist options
  • Save igortik/3c4a5e4b86380bcaab243bedd825da10 to your computer and use it in GitHub Desktop.
Save igortik/3c4a5e4b86380bcaab243bedd825da10 to your computer and use it in GitHub Desktop.
Nginx & Cloudflare real IP configuration
# Look for client IP in the X-Forwarded-For header
real_ip_header X-Forwarded-For;
# Ignore trusted IPs
real_ip_recursive on;
# Trusted list
set_real_ip_from 199.27.128.0/21;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.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;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/12;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment