Short answer: The most effective Cloudflare security settings for WordPress on the Free plan are: set SSL/TLS to Full (strict) with a valid certificate on your server, turn on Always Use HTTPS, keep the Free Managed Ruleset enabled, and spend your five custom WAF rules on the WordPress paths attackers hit most: wp-login.php, xmlrpc.php, wp-admin from outside your country, and known bad user agents. Use your one free rate limiting rule on the login page. Add Bot Fight Mode only after testing, never cache wp-admin or logged-in pages, and restore real visitor IPs on the server. Most importantly, make sure your origin server only accepts web traffic from Cloudflare, because a leaked origin IP lets attackers skip Cloudflare entirely.
What Cloudflare can and cannot do for WordPress
Cloudflare sits in front of your site as a reverse proxy. Visitors connect to Cloudflare, which filters and caches requests before passing them to your server. That makes it good at stopping brute-force login floods, crude vulnerability scanners, junk bot traffic and denial-of-service attacks. It cannot fix a vulnerable plugin, remove malware already on the server, or stop an attacker who logs in with a stolen admin password. Treat it as one layer alongside updates, strong logins and backups. Our WordPress security checklist ranks those other layers.

The settings below assume your DNS records for the site are proxied, shown as an orange cloud in the DNS tab. Grey-cloud records bypass Cloudflare completely.
SSL/TLS: choose Full (strict)
In SSL/TLS, Overview, Cloudflare offers several encryption modes. Flexible encrypts only between the visitor and Cloudflare, leaving the hop to your server in plain text, and it commonly causes redirect loops with WordPress. Full encrypts both hops but does not check your server’s certificate. Full (strict) encrypts both hops and verifies the certificate, which is the setting you want.
Your server needs a valid certificate for Full (strict). Let’s Encrypt certificates from your host or control panel work, as does a free Cloudflare Origin CA certificate installed on the server, which is trusted by Cloudflare but not by browsers directly. Then, under Edge Certificates, turn on Always Use HTTPS and Automatic HTTPS Rewrites. Enable HSTS only once you are sure every subdomain works over HTTPS, because browsers will refuse plain HTTP for the duration you set. Set Minimum TLS Version to 1.2.
The Free Managed Ruleset and security level
Cloudflare includes a Free Managed Ruleset on all plans, which targets high-impact, widely exploited vulnerabilities. Check under Security, WAF, Managed rules that it is deployed. Paid plans add the broader Cloudflare Managed Ruleset and the OWASP core ruleset, which are worth it for busy WooCommerce stores but not essential for small blogs.
Leave the general security level at its default. Under Attack Mode, which shows a challenge page to every visitor, is for active attacks only, because it hurts real visitors and can break some integrations. Turn it on during a flood, then off once the rules below take over.
Spending your five custom rules
According to Cloudflare’s documentation, the Free plan allows 5 custom rules, Pro 20 and Business 100. Five is enough if you combine conditions thoughtfully. Create them under Security, WAF, Custom rules. A sensible WordPress set looks like this:
| Rule | Matches | Action | Why |
|---|---|---|---|
| 1. Block XML-RPC | URI path equals /xmlrpc.php | Block | Used for credential stuffing and pingback abuse; rarely needed unless you use Jetpack or the mobile app |
| 2. Protect login | URI path contains /wp-login.php and not your IP or country | Managed Challenge | Stops automated login attempts while letting humans through |
| 3. Protect admin | URI path starts with /wp-admin, excluding /wp-admin/admin-ajax.php | Managed Challenge for countries you never log in from | Reduces exposure without breaking front-end AJAX |
| 4. Block sensitive files | Path contains wp-config, .env, .git, readme.html, or ends in .sql, .bak, .zip in uploads | Block | Stops scanners looking for leaked backups and configuration |
| 5. Block known bad traffic | Empty user agent, or obvious scanner user agents, or threat score high | Block or Managed Challenge | Cuts junk crawlers and vulnerability scanners |
Here is an example expression for rule 2 in Cloudflare’s rule language, adapted to your own IP address:
(http.request.uri.path contains "/wp-login.php" and not ip.src in {203.0.113.10})
And for rule 3, avoiding admin-ajax.php, which many themes call from public pages:
(starts_with(http.request.uri.path, "/wp-admin") and not http.request.uri.path eq "/wp-admin/admin-ajax.php" and not ip.src.country in {"VN" "SG"})
Before blocking XML-RPC, check whether you use the WordPress mobile app, Jetpack or a service that publishes remotely. If so, use a challenge on that path instead or allow the service’s IP ranges. If you have moved your login URL with a plugin, protect the new path too; our guide to changing the WordPress login URL compares that approach with firewall challenges.
The one free rate limiting rule
Cloudflare made basic rate limiting available on Free plans in 2022. Its announcement states that new Free customers get one rule, counted by IP address, with a maximum counting period of 10 seconds, matching on path. The obvious place to use it is the login page. Under Security, WAF, Rate limiting rules, create a rule for requests where the path contains /wp-login.php and the method is POST, with a threshold such as 5 requests per 10 seconds per IP and a block action for a set duration.

That threshold will not affect a human mistyping a password, but it stops tools that hammer the login form. Combine it with server-side protection such as login attempt limits and two-factor authentication, explained in our guide to stopping WordPress brute force attacks.
Bots: Bot Fight Mode and Turnstile
Bot Fight Mode, under Security, Bots, challenges traffic that Cloudflare identifies as automated. It is free and can noticeably reduce junk traffic, but it is coarse: it cannot be bypassed with custom rules on the Free plan, and it may interfere with legitimate services such as uptime monitors, payment gateway callbacks, some RSS readers and API clients. Turn it on, then test your contact forms, checkout, webhooks and any integrations. If something breaks, turn it off and rely on the custom rules above.
For forms, Cloudflare Turnstile is a free CAPTCHA alternative that many WordPress form and login plugins support. It reduces comment and registration spam without the puzzles that frustrate visitors.
Caching without leaking private pages
Caching speeds up the site and absorbs traffic spikes, but caching the wrong pages can show one user’s logged-in view to another. Never cache /wp-admin, /wp-login.php, preview URLs, the cart, checkout or my-account pages, or any request with a wordpress_logged_in or woocommerce cookie. Cloudflare’s default behaviour caches static files like images and CSS but not HTML, which is safe. If you add Cache Rules to cache HTML, include bypass conditions for those paths and cookies. After major site changes or a malware clean-up, purge the cache so stale or infected copies are not served.
Locking down the origin
This is the step most sites skip. Cloudflare only protects traffic that goes through Cloudflare. If an attacker finds your server’s real IP address, they can send requests directly to it and bypass every rule above. Origin IPs leak through old DNS history, mail records pointing to the same server, subdomains left grey-clouded, or the server’s response to direct requests.
- Restrict web ports to Cloudflare: configure your server firewall to allow ports 80 and 443 only from Cloudflare’s published IP ranges, available at cloudflare.com/ips.
- Authenticated Origin Pulls: under SSL/TLS, Origin Server, enable this so your server only accepts connections presenting Cloudflare’s client certificate.
- Separate mail: host email elsewhere or on a different IP, since MX records are public and cannot be proxied.
- Check subdomains: any record that points at the origin with a grey cloud reveals the IP.
If you use aaPanel, cPanel or another control panel, also keep the panel’s own port away from the public internet. Our guide to securing WordPress on aaPanel covers panel lockdown.
Restore real visitor IPs on the server
Behind Cloudflare, your server sees Cloudflare’s IP addresses rather than visitors’. That breaks login limiters, security plugins and logs, which may end up blocking Cloudflare itself. Configure your web server to read the CF-Connecting-IP header from Cloudflare’s ranges only. On Nginx that means the real_ip module with set_real_ip_from lines for each range; on Apache, mod_remoteip with RemoteIPHeader CF-Connecting-IP and RemoteIPTrustedProxy entries.
real_ip_header CF-Connecting-IP;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
Include every current range from Cloudflare’s list, and update it occasionally.
Security headers and a final check
Cloudflare can add some response headers through Transform Rules, but headers such as Content-Security-Policy are usually easier to manage on the server. Our guide to WordPress security headers provides tested values. After setting everything up, review Security, Events for a few days to see which rules are firing, and adjust any rule that is challenging real visitors.
Frequently asked questions
Do I still need a WordPress security plugin with Cloudflare?
Cloudflare filters traffic at the edge, but it cannot see file changes, malicious admin users or vulnerable plugins on the server. A lightweight security or monitoring plugin still adds value.
Will blocking xmlrpc.php break my site?
For most sites, no. It can break the WordPress mobile app, Jetpack and some remote publishing tools. Test those features after blocking, or use a challenge instead.
Is Under Attack Mode safe to leave on?
It is safe but unfriendly. Every visitor sees an interstitial check, and some services fail. Use it during attacks only.
Why do I get redirect loops after enabling Cloudflare?
Usually because SSL mode is Flexible while WordPress forces HTTPS. Install a certificate on the server and switch to Full (strict).



