Skip to content

Instantly share code, notes, and snippets.

@halkeye
Last active October 5, 2016 20:00
Show Gist options
  • Save halkeye/71f6da042081c29259ce to your computer and use it in GitHub Desktop.
Save halkeye/71f6da042081c29259ce to your computer and use it in GitHub Desktop.
Pull cloudflare ips for nginx
# cat /etc/nginx/conf.d/cloudflare.conf
# sh cloudflare_ips_nginx.sh > /etc/nginx/conf.d/cloudflare.conf && service nginx configtest && service nginx reload
echo "# Cloudflare"
for ip in $(curl -s https://www.cloudflare.com/ips-v4); do
echo "set_real_ip_from $ip;"
done
for ip in $(curl -s https://www.cloudflare.com/ips-v6); do
echo "set_real_ip_from $ip;"
done
echo "real_ip_header CF-Connecting-IP;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment