Blueprints · Reverse Proxy & SSL
Production
15 min · Nginx
Cloudflare real client IP
Stages real_ip so logs show the visitor instead of the Cloudflare edge. Update the ranges when Cloudflare publishes new ones.
Baked-in protections
- set_real_ip_from is limited to Cloudflare ranges in the file
- The list is a snapshot you must refresh
- Nginx is not reloaded
Step 1 · conf
real_ip snippet
/root/portgate-blueprints/cloudflare-real-ip.conf
Replace the ranges with the current Cloudflare list before you include this.
real_ip_header CF-Connecting-IP; # Refresh these ranges from https://www.cloudflare.com/ips/ before use. set_real_ip_from 173.245.48.0/20; set_real_ip_from 103.21.244.0/22; set_real_ip_from 2400:cb00::/32;
Step 2 · bash
Read-only check
/root/portgate-blueprints/real-ip-check.sh
Prints status. It does not change the service.
#!/bin/sh set -eu nginx -t 2>&1 || echo "nginx -t failed or nginx is not installed."