Cloudflare's free tier + Shield's free tier is the most cost-effective WordPress security stack you can build. Here's how to wire them together correctly:
1. Trust Cloudflare's real-IP headers. When CF is in front, every request reaches your server with CF's IP as REMOTE_ADDR and the visitor's real IP in CF-Connecting-IP. Shield reads this header automatically — but only if you enable the toggle:
Settings → Whitelist → "Trust Cloudflare automatically" → ON.
Without this, Shield would ban CF's edge IPs (because they'd show up as the source of every request) — that effectively kills your site for everyone.
2. Don't double-rate-limit. If you have a Cloudflare rate-limit rule that already throttles /wp-login.php, you can leave Shield's rate-limit rule active too — they're complementary. CF blocks the obvious volumetric brute-force; Shield catches the slow distributed brute-force that CF's threshold misses.
3. Let Shield use CF's country header. CF sets CF-IPCountry on every request. Shield uses it for: country-based firewall rules, the threat report's geographic dimension, and the auto-detect-language feature on the SaaS dashboard. No config needed — it just works.
4. CDN cache invalidation on block. When Shield blocks an IP, it sets Surrogate-Control: max-age=3600 and CDN-Cache-Control: max-age=3600 on the 403 response. Cloudflare reads these and caches the 403 — so the next 1,000 requests from the same blocked IP NEVER reach your server. Massive perf win during an attack.
5. What each layer handles:
- CF: volumetric DDoS, basic bot challenge, geographic blocking, edge caching
- Shield: 16-signal behavioral detection, AI scraper classification, network consensus, Wordfence vuln scanning, login audit, rescue mode, traffic mix donut
- Both: rate limiting (CF for crude, Shield for surgical)
Result: a $0/month security stack that beats most $300/month enterprise solutions on the metrics that matter for WordPress sites.