Cloudflare is a network of reverse proxy servers that sits between your site and your visitors. When you manage your domain's DNS records through Cloudflare, visitors connect not directly to your server but to Cloudflare's servers around the world. This way, static files are served from a point close to the visitor, harmful traffic is filtered before it reaches your server, and SSL management becomes easier. In this guide we cover the basic setup for WordPress, the correct settings, and the most common mistakes.
What Cloudflare does and does not do
Cloudflare is not a magic accelerator; knowing what it solves keeps your expectations accurate.
- CDN and caching: Static files such as images, CSS, and JavaScript are delivered from a server close to the visitor, which reduces the load on your server.
- DDoS and bot protection: Excessive traffic and known malicious bots can be blocked before they reach your site.
- SSL/TLS and HTTP/3: Free certificates and support for modern protocols.
- DNS: A fast, reliable DNS service.
Cloudflare alone will not solve slow themes, heavy page builders, or unoptimized database problems. Server-side slowness requires a caching plugin and a clean installation. So think of Cloudflare as an "additional layer."
Connecting Cloudflare to your WordPress site
- Create an account on Cloudflare and add your domain. The free plan is sufficient to start.
- Cloudflare automatically scans your existing DNS records. Make sure no records are missing: check your A, CNAME, MX (email), and TXT records in particular. The MX records used for email, and the A records tied to them, must stay as "DNS only" (grey cloud).
- At your domain provider, replace the nameservers with the addresses that Cloudflare gives you.
- When propagation is complete, your domain shows as "Active" in the Cloudflare dashboard.
An orange cloud icon on a site record (A or CNAME) shows that traffic passes through Cloudflare. To hide your server address and gain protection, your main site record should be on the orange cloud.
SSL/TLS mode: choose "Full (strict)"
One of the most common errors on WordPress sites is an endless redirect loop. The cause is usually the SSL mode being set to "Flexible" while the server also forces a redirect from HTTP to HTTPS. If you have a valid certificate on your server (a free Let's Encrypt certificate is fine), set the mode to Full (strict) in Cloudflare. This way, the connection between the visitor and Cloudflare, and between Cloudflare and your server, is encrypted. Then turn on the "Always Use HTTPS" option and confirm that your WordPress addresses begin with https.
Cache settings
Static files
By default, Cloudflare caches static files such as images, CSS, and JavaScript. You can keep the browser cache lifetime long; when a file name changes (through a version parameter), fresh content is fetched.
HTML pages
By default, HTML pages are not cached on Cloudflare. If you cache all HTML, two risks arise for WordPress: a logged-in user may be shown someone else's page, and on WooCommerce the cart or account pages may get mixed up. To prevent this, use Cache Rules to bypass the following paths:
/wp-admin/and/wp-login.php- Requests that have a
wordpress_logged_incookie or a WooCommerce session cookie - Cart, checkout, and My Account pages
- REST API and AJAX endpoints
For those who want full page caching, Cloudflare's paid WordPress-specific product APO (Automatic Platform Optimization) manages these rules itself. Alternatively, you can leave page caching to a WordPress plugin and use Cloudflare for static files and protection.
Using it together with plugins
Cloudflare and a caching plugin complement each other; divide the tasks to avoid conflicts. Keep page caching, CSS/JS combining, and deferred loading in the plugin, and keep DNS, CDN, and attack protection on Cloudflare. Plugins such as WP Rocket and FlyingPress Pro offer integration options with Cloudflare; they make sure the Cloudflare cache is cleared automatically when a post or page is updated. Settings vary by plugin, so follow the guidance of the relevant plugin.
To disable unnecessary script and style files on a per-page basis, you can use Perfmatters; although Cloudflare serves a file quickly, a file that never loads is always faster. For image sizes, a compression plugin such as ShortPixel works well alongside Cloudflare: shrink the file first, then distribute it through the CDN. For general speed settings, you can also browse the WordPress Plugins & Themes products in the category page.
Security settings
Cloudflare's security features are especially useful for WordPress sites. Recommended settings:
- Bot Fight Mode / Super Bot Fight Mode: Filters known malicious bots with a challenge. To make sure legitimate bots (Google, payment provider callbacks) are not blocked, monitor the event log during the first few days.
- WAF rules: Turn on the managed rule sets. The free plan has limited coverage, but it still provides basic protection.
- Rate limiting: Restrict brute-force attempts aimed at
/wp-login.phpand/xmlrpc.php. - Admin panel protection: You can set a country- or IP-based rule for
/wp-admin/. Be careful not to lock yourself out. - Real visitor IP: Behind Cloudflare, your server may see the wrong visitor IP; for security plugins and spam filters, the real IP must be read from the
CF-Connecting-IPheader.
If you want an extra layer against form and comment spam, you can use a cloud spam filter such as Cleantalk alongside Cloudflare. Cloudflare works at the network level, while Cleantalk works at the application level.
Cloudflare settings summary
| Setting | Recommended value | Why? |
|---|---|---|
| SSL/TLS mode | Full (strict) | End-to-end encryption, no redirect loops |
| Always Use HTTPS | On | All traffic is redirected to https |
| Brotli / HTTP/3 | On | Smaller files, faster connections |
| HTML caching | Only with rules and exceptions | Prevents session and cart mix-ups |
| Bot Fight Mode | On, monitored in the log | Reduces malicious bot traffic |
| Login page limit | Rate limiting rule | Slows down brute-force attempts |
Common mistakes and additional tips
Mistakes and their fixes
- Redirect loop: Set the SSL mode to "Full (strict)" and confirm that the WordPress address uses https.
- Old version showing in the admin panel: Clear the Cloudflare cache and check the rule that bypasses the cache for wp-admin.
- Emails not arriving: The MX records and the records tied to them may have been moved to the orange cloud. Switch the A record pointing to the mail server to the grey cloud.
- New content appears late: Enable the plugin integration for automatic cache clearing after publishing.
- You are blocking yourself: Review the security level and WAF events, and add your own IP to the allow list.
After making a change, test your site from a different device and in a private window; try it in both states, logged in and logged out. To measure the speed effect, compare the results before and after the change with the same tool.
Additional gains on images and scripts
Some of the extra options Cloudflare offers appear on the settings page but go unnoticed unless you deliberately turn them on. For WordPress sites, consider the following:
- Brotli compression: Sends text-based files (HTML, CSS, JavaScript) in a smaller size.
- Early Hints: Tells the browser in advance which resources the page will need while it loads; this can improve perceived speed.
- Image transformation and resizing: Depending on your plan, there are options to serve images in modern formats. However, if a WordPress plugin is already doing the same job, do not run both at once, or you will get conflicts and unnecessary processing.
- Minify options: Both Cloudflare and a plugin can minify CSS and JavaScript. Keep it enabled in only one of them; otherwise the page may break.
If you notice no problems within an hour after changing a setting, check again the next day anyway: some errors only appear on certain pages or for logged-in users. Changing one setting at a time, rather than several at once, makes it easier to find the cause when a problem appears.
What to check besides Cloudflare
Most speed problems come from the server and the site's content. Before or after moving to Cloudflare, check these basics: are you using a current PHP version, is your database bloated, are unused plugins still on the site, are the images larger than necessary? Adding a CDN alone, without fixing these, produces limited improvement. Then measure your Core Web Vitals scores, see which metric is still weak, and act accordingly.
Frequently Asked Questions
Is the free Cloudflare plan enough?
For small and medium-sized WordPress sites, the free plan is usually sufficient. For more comprehensive firewall rules, advanced bot management, and features such as APO, you may need a paid plan.
If I use Cloudflare, do I still need a caching plugin?
Yes. Cloudflare speeds up only the network and static file layers. To reduce PHP and database load on the server, keep using a plugin that provides page caching.
Does Cloudflare affect SEO?
When configured correctly, it has a positive effect: speed improves and server outages decrease. If incorrect bot settings block search engine bots, you will run into problems, so monitor crawl errors in Search Console.
Do I need to transfer my domain to Cloudflare?
You do not need to transfer the domain registration. You only point the nameservers to Cloudflare; the registrar stays the same.
