Skip to content

Instantly share code, notes, and snippets.

@arenadoon
Forked from igortik/nginx_cloudflare.conf
Created August 21, 2019 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arenadoon/1dc48d44b3ca3e498c652a24c790ad4e to your computer and use it in GitHub Desktop.
Save arenadoon/1dc48d44b3ca3e498c652a24c790ad4e 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