Hardening Web Applications Behind Cloudflare Proxy and Nginx Reverse Proxies

INTTECH Security Engineering — October 2026

Best practices for restoring real visitor IP headers, configuring strict TLS ciphers, mitigating brute-force SSH attempts with Fail2Ban, and protecting API endpoints.

1. Preserving Client IP Telemetry Through Edge Proxies

When routing traffic through Cloudflare CDN to an origin Nginx server, access logs default to edge node IP addresses unless ngx_http_realip_module is configured to trust CF-Connecting-IP headers. Accurate client IPs are essential for rate limiting and security auditing.

2. Origin Lockdown & Automated Intrusion Prevention

Origin servers should restrict direct HTTP/HTTPS ingress exclusively to Cloudflare IP ranges while moving administrative SSH access to non-standard ports protected by public-key authentication and Fail2Ban jails.

3. Security Headers & Crawler Accessibility

Configuring X-Content-Type-Options, Referrer-Policy, and clean static routing for ads.txt, robots.txt, and sitemap.xml ensures browsers enforce strict security boundaries while legitimate search and ad crawlers index content without friction.