Cloudflare & Proxy Support
If your site is behind Cloudflare, a load balancer, or any reverse proxy, AffLoc automatically detects the real visitor IP.
IP Detection Priority
AffLoc checks these headers in order:
- CF-Connecting-IP — Set by Cloudflare. Most reliable when using Cloudflare.
- X-Forwarded-For — Set by most reverse proxies and load balancers. AffLoc takes the first (leftmost) IP from the comma-separated list.
- REMOTE_ADDR — The direct connection IP. Used as a last resort.
IP Validation
All detected IPs are validated using PHP’s filter_var() with FILTER_VALIDATE_IP. Invalid IPs fall back to a safe default.
Cloudflare-Specific Notes
- AffLoc works out of the box with Cloudflare — no configuration needed.
- The
CF-Connecting-IPheader is automatically used when present. - Compatible with Cloudflare’s APO (Automatic Platform Optimization) for WordPress.
Tip: If you’re using Cloudflare, the IP detection is more accurate because Cloudflare always sends the real visitor IP in the CF-Connecting-IP header.