Domains & Hosting · Updated December 4, 2026 · About 15 min read

Cloudflare CDN Setup Guide: Connecting a WordPress Site

From saving DNS records and adding a domain to switching nameservers and verifying HTTPS and caching, here is how to connect WordPress to Cloudflare, plus checks for email, dynamic pages and rollback.

Connecting to Cloudflare: DNS · HTTPS · cache verification

Before you begin: Export your current DNS records and note the original nameservers. Don't enable web proxying for mail records, and before changing caching rules, confirm that logins, forms and checkout won't be cached by mistake.

Cloudflare is commonly used for DNS management, proxied access, caching and site protection. Adding a domain to Cloudflare does not automatically speed up every piece of content, and it does not replace origin security configuration.

This tutorial is for anyone who already owns a domain and has a running WordPress site. The steps involve a DNS switch, so schedule a maintenance window for important production sites and save the existing records.

1. What to prepare before onboarding

  • Access to the registrar's dashboard, with permission to change the authoritative nameservers.
  • Access to the current DNS dashboard, so you can export existing records.
  • The origin IP, any alias address from your host and the site's current HTTPS status.
  • A check of MX, SPF, DKIM and other mail records so email keeps working after the DNS move.
  • Confirmation of whether another CDN or security proxy is already in use, to avoid conflicting proxies and caches.

2. Step one: add the domain to Cloudflare

Open the Cloudflare dashboard, add your root domain, for example example.com. Choose a plan based on your needs, then review the DNS records Cloudflare scanned or imported.

Important: automatic scans can miss records. Compare web records, mail records, subdomains and TXT verification records one by one against the old DNS.

3. Step two: decide which records are proxied

For ordinary A, AAAA or CNAME records, choose proxied (orange cloud) or DNS-only (grey cloud) according to your origin and provider requirements.

Mail-related MX and TXT records are for name resolution and should not be treated as proxied web traffic. Some FTP, SSH and other services are usually not suitable for web proxying either.

If your host includes a CDN, read the provider's compatibility notes about external proxies before turning on Cloudflare proxying.

4. Step three: change the domain's nameservers

Once Cloudflare assigns authoritative nameservers to the domain, go to your registrar's dashboard and replace the old NS values.

Check any existing DNSSEC configuration first; if the old DNSSEC records don't match the new authoritative DNS, resolution can fail. Follow Cloudflare's official migration instructions, then re-enable DNSSEC where needed.

How long NS changes take depends on the registrar and DNS caching. Don't delete your backup of the old configuration during that period.

5. Step four: configure HTTPS and SSL

First make sure the WordPress origin has a working HTTPS certificate, then configure the secure connection between Cloudflare and the origin. Where supported, prefer a mode that strictly validates the origin certificate.

Don't pick a mode that skips origin validation just to silence an error — that can hide a real certificate problem.

When you are done, test that these addresses redirect correctly:

  • http://example.com
  • https://example.com
  • http://www.example.com
  • https://www.example.com

Check for certificate errors, redirect loops or mixed-content warnings in the browser.

6. Step five: enable caching gradually

Start with static assets such as images, CSS and JavaScript. Don't apply long cache times to the whole site's HTML without verification.

In particular, avoid caching the WordPress admin, login pages, carts, checkout pages and personalized content. If you use WooCommerce, read the ecommerce caching compatibility notes carefully.

More cache rules are not necessarily better. Change one thing at a time and observe the real result before moving on.

7. Step six: verify the result

  1. Open the homepage and key inner pages to confirm they load normally.
  2. Check developer tools for large numbers of 404 or mixed-content errors.
  3. Test logging in, publishing a post, submitting a form and uploading an image.
  4. If you have email, test both sending and receiving.
  5. Compare before and after with PageSpeed Insights rather than relying on a single speed test.
  6. Check cache status and whether any page is showing stale content.

8. What to do if something breaks

If origin access fails after proxying is enabled, check DNS records, SSL, the origin firewall and proxy compatibility first. If needed, temporarily switch the affected web records to DNS-only while you isolate the problem.

If you must fully restore the old DNS, roll back using the saved records and NS information, bearing in mind that propagation can still take time. Don't change several settings at once while the cause is unclear.

Summary

The right order for onboarding to Cloudflare is: Back up old DNS → add the site → compare records → change NS → verify SSL → enable caching gradually → validate the whole site.

Reference: Cloudflare's official onboarding documentation.

FAQ

Can I delete the old DNS records after enabling Cloudflare?

Save the complete records and check web, mail and subdomains before the switch. Only clean up the old configuration once the new authoritative DNS is confirmed to work, and only for services that are actually migrated.

Can every record be proxied?

No. Web proxying has protocol and record requirements, and mail hostnames usually need DNS-only. Configure records according to the official guidance and the actual service.

Further reading

Official sources and references

Sources last checked on October 1, 2026. Software interfaces and service terms can change — always compare against the version you are actually using.

We use Google Analytics to understand how the site is used. It is only turned on if you accept. Privacy policy