Privacy

Connect Cloudflare to WordPress: DNS, HTTPS and mail records

Move DNS to Cloudflare with a record inventory, a DNSSEC transition and checked HTTPS. Keep mail DNS-only and protect WordPress login and checkout from unsafe caching.

Made by Pagember · Editorial policy

Primary sources + editorial analysisPublished Updated Sources

The short answer

Connect Cloudflare in stages. Export and reconcile your full DNS zone, remove any old DNSSEC DS record at the registrar and wait for it to expire, keep mail records DNS-only, and confirm a valid origin certificate with Full (strict) encryption. Only after changing nameservers should you proxy the website records, then test login, forms, checkout and email, keeping login, checkout and account pages out of custom cache rules.

On this page12 sections

Connect Cloudflare in stages: preserve DNS, establish HTTPS, then enable the web proxy and test the site. Keep ordinary email traffic DNS-only and avoid broad full-page caching during setup. If your host already manages Cloudflare or another CDN, confirm its supported route before adding a second configuration.

Cloudflare name above a conceptual layers diagram: DNS records, HTTPS, Cache.

This guide covers an existing WordPress site on Cloudflare's primary full-zone setup, where Cloudflare becomes authoritative for the domain's DNS. The domain name and WordPress addresses stay the same. Partial/CNAME, secondary DNS, Multisite and host-integrated services can require different instructions. You do not need to transfer domain registration or move WordPress files merely to change DNS providers.

The whole job in order:

  1. Export the current DNS zone and note DNSSEC, mail and certificate settings.
  2. Add the domain to Cloudflare and compare the imported records with your export, line by line.
  3. If DNSSEC is on, remove the old DS record at the registrar and wait for its TTL to expire.
  4. Set mail-related records to DNS-only (gray cloud) and leave web records DNS-only for now.
  5. Check that the origin has a valid certificate and choose Full (strict) encryption.
  6. Change the nameservers at the registrar, then turn on the proxy for the website records.
  7. Test login, forms, cart and email, and keep login, checkout and account pages out of any custom cache rule.

Each step is explained in its numbered section below.

First, decide whether you need this change

SituationUseful next stepAvoid
Ordinary WordPress site, independent DNS and compatible hostPrepare full-zone DNS onboarding and test the proxy in stagesChanging mail providers or WordPress URLs at the same time
Host already supplies Cloudflare/CDN integrationAsk the host which account, DNS and proxy route it supportsStacking proxies, redirects or optimization plugins blindly
Only stale content or a slow pageDiagnose the existing cache/application before adding a CDNAssuming a new service fixes every performance problem
No registrar access or unknown DNSSEC stateResolve control and transition details firstReplacing nameservers without an inventory or recovery owner
Match the need to the smallest useful change

Use our domain account-control guide to find the authorized owner. If you only need web DNS pointing, start with connecting a domain without breaking email. Record the intended benefit and how you will check it. Cloudflare does not guarantee a faster site, better rankings or a recovered application.

1. Capture the DNS and service baseline

Before any change, record the registrar, current nameservers, authoritative DNS provider, host/CDN and mail provider. Export the existing DNS zone if supported and save a dated record list privately. Include name, type, value, priority where applicable and TTL. Record DNSSEC/DS status at the registrar, existing certificates, proxy/cache/redirect settings and account recovery access. A website backup does not recreate all those service settings.

Check more than the apex and www records: include mail hosts, MX, SPF, DKIM selectors, DMARC, verification CNAME/TXT records, service subdomains, SRV and any delegated subdomains. Cloudflare's quick scan is not a complete inventory; unusual hostnames and DKIM selectors can be missed. Compare with the old authoritative provider and each actual service's requirements, not just what appears in the scan.

Also take a checked WordPress files/database backup and agree a recovery operator; our restoration guide covers that separate task. Record baseline results for HTTPS, login, an important page, form delivery and any cart/account journey. Arrange safe test addresses or payment-provider test mode. Do not place real orders or include customer information in a general change log.

2. Add the domain and reconcile every required record

In the correct Cloudflare account, add the existing domain through the full-setup flow and select the plan that meets the requirement. Before changing delegation, compare its proposed DNS records with your saved inventory. Cloudflare supports zone import/export, but the import's proxy option and per-record proxy tags can alter eligible records. Review the result instead of treating import completion as acceptance.

Confirm web A/AAAA or CNAME destinations with the host. An IPv6 record pointing to a previous server can produce different results for different visitors. Preserve required mail/authentication records and third-party services. Do not copy the previous provider's apex nameserver records as a substitute for changing delegation at the registrar; retain intentional subdomain delegations according to their own configuration.

3. Coordinate DNSSEC before nameserver replacement

For the standard migration, follow Cloudflare's DNSSEC procedure: remove the old DS record at the registrar and wait for its parent-zone TTL to expire before switching nameservers. Disabling signing only at the old DNS provider can leave a cached DS pointing at absent or different keys and cause validation failures. Have the registrar/provider confirm the state and timing; a dashboard toggle alone is insufficient.

After changing nameservers, wait for the previous NS/delegation TTL to expire and verify the new authoritative path with the DNS operator before enabling Cloudflare DNSSEC and publishing its current DS through the registrar's supported route. Check whether DS publication is automated. Verify validation. A continuous signed migration needs the providers' supported multi-signer arrangement, not a mixture of instructions. For later DS removal, keep signing enabled until the removed DS's TTL has expired. DNSSEC rollback is not an instant universal toggle; keep the responsible DNS operator involved.

4. Choose proxy status by service

Proxy status determines whether eligible A, AAAA or CNAME web requests pass through Cloudflare or go directly to the configured destination. Proxy only compatible HTTP/HTTPS hostnames. A DNS-only web hostname retains direct-origin exposure and does not receive Cloudflare's web-proxy protection. Some third-party website or verification services require DNS-only records even though their names resemble web records.

Record/serviceSetup choiceVerify
Compatible website apex/www A, AAAA or CNAMEPrepare HTTPS, then enable proxy when readyCorrect host destination, certificates and visitor journeys
Ordinary mail-server A/AAAA or mail-related CNAMEDNS-only, following the mail providerMail client and external delivery still reach that provider
MX and TXT authentication recordsDNS records; not HTTP-proxy switchesExact provider values, priorities and full record names
Verification CNAME or non-HTTP serviceUse the provider-required DNS-only setupProvider verification and service-specific connectivity
Web proxy choices are different from email routing

Cloudflare's email guidance keeps an ordinary mail-server address DNS-only; the normal web proxy does not carry SMTP on port 25. If MX points to your own mail hostname, check that hostname's address record too. An MX record can look correct while its target is accidentally proxied. Use your mail provider's values; the documentation's example server is not your mail destination.

Retain SPF, DKIM, DMARC and verification records, preserving selectors and record names. See our mail authentication guide. Activating Cloudflare DNS does not require turning on its Email Routing product or replacing your existing mail subscription. Test receiving, sending and replying from an independent external account; a website form's success message does not prove inbox delivery. Use form-email troubleshooting if that separate path fails.

5. Establish the two HTTPS connections

There are two certificate boundaries: the visitor connects to Cloudflare's edge, and Cloudflare connects to your origin host. For Full (strict), the origin must accept HTTPS on port 443 and present an unexpired certificate matching the requested/target hostname, issued by a publicly trusted authority or Cloudflare Origin CA. Ask the host to verify these origin requirements first. Then, in Cloudflare's SSL/TLS → Overview, confirm or select Full (strict) as the effective encryption mode before enabling web proxying. Edge HTTPS alone is not proof of a valid origin connection.

Check Universal SSL in the Edge Certificates dashboard and require its status to be Active for the intended hostnames before enabling the proxy. With full setup, issuance follows zone activation. Keeping web records DNS-only while waiting is an option only when direct-origin HTTPS already works. Default coverage includes the apex and first-level subdomains; a deeper hostname needs a specific coverage check. Do not promise an exact provisioning time.

Origin CA certificates are trusted for the Cloudflare-to-origin connection, not by ordinary visitor browsers. Pausing the proxy or changing a web record to DNS-only can therefore expose a certificate trust error. A viable direct-origin recovery route needs a browser-trusted certificate and compatible host/firewall access. Plan that dependency before relying on a proxy-off fallback.

6. Change delegation, then enable compatible web proxying

Once the record comparison, DNSSEC transition and origin plan are accepted, follow Cloudflare's full-setup sequence: obtain the nameserver pair assigned to this zone and replace the previous authoritative nameservers in the registrar's designated nameserver controls. Do not guess names or edit only an ordinary NS record in the old zone. Preserve the old DNS service and its matching records for the transition/recovery window.

Verify delegation through the registrar and independent DNS lookups, and require the Cloudflare zone to show Active. Cached answers can differ while previous TTLs expire; repeated switching makes diagnosis harder. When the edge certificate and origin HTTPS checks pass and Full (strict) is confirmed as the effective mode, enable proxying for the compatible web records. Retest the same baseline journeys after each stage and record the observation time and network used.

7. Keep private and transactional pages dynamic

Start with the existing safe application configuration. If your host already runs a Cloudflare-backed edge cache, use the host’s controls first; Kinsta, for example, distributes eligible cached pages through Cloudflare as part of its hosting, and the Kinsta cache layers guide explains which copy to purge. For page caching inside WordPress, WP Rocket excludes WooCommerce cart, checkout and account pages automatically when it detects them. Cloudflare does not cache HTML or JSON by default; custom rules, Workers, APO or host/plugin caches may change the effective result. Do not enable Cache Everything for the whole WordPress site as a generic speed fix. Establish the working baseline before making additional optimization changes.

Review login and administrator paths, including the actual wp-login.php and wp-admin routes, account/member pages, previews and application API/form endpoints. Personalized responses and authenticated HTML must not be shared with other visitors. Use the relevant Cache Rules bypass setting where a custom cache rule would otherwise match; check effective rule ordering, existing Workers and the origin's cache controls. A pasted path list cannot account for every plugin or custom login URL.

For WooCommerce, Cart, Checkout and My Account must remain dynamic. Use their actual configured URLs and account for cart/session cookies, add-to-cart actions and gateway/API callbacks. Confirm exclusions at every relevant cache layer, not only one WordPress plugin. Follow the host/cache integration's current procedure rather than pasting an old Varnish configuration into Cloudflare.

Test separately as a logged-out visitor and an authorized test user, including cart changes, sign-in/out and form submission. Cloudflare documents login failures caused by aggressive caching and removed Set-Cookie headers. A qualified operator can inspect response headers and whether session cookies persist. One cache-status value alone does not establish safety. If private content appears across sessions, stop the custom caching change, purge affected copies through the supported controls and investigate before resuming.

8. Diagnose the failing layer before rolling back

Observed failureCheck firstAvoid
Domain missing or DNS validation failureDelegation, missing records and parent DS/DNSSEC state with the registrarChanging WordPress's URL or waiting indefinitely without diagnosis
Mail stops after the DNS changeAuthoritative MX/authentication records and DNS-only mail targetsReplacing the email provider or forwarding all mail elsewhere
526 or a certificate warningOrigin validity/hostname and edge activation/coverage respectivelyDisabling validation as the permanent solution
Redirect loopEncryption mode and competing host/WordPress/CDN redirectsAdding another redirect or switching blindly to Flexible
Login, form or cart breaksEffective cache rules, cookies and security challenge eventsTurning off all security or treating a homepage load as acceptance
Use the symptom to choose the next check

For redirect loops, note that Flexible sends HTTP to the origin and can conflict with origin HTTPS enforcement. Have the responsible operator align the encryption and redirect policy. If a rule blocks a legitimate callback or login, narrow the responsible rule after reviewing its event; do not remove all protection to make one test pass.

Capture the exact failing hostname/path, time/timezone, error/status and recent change. Ask the relevant host, registrar, mail provider or Cloudflare support route for help, sharing scoped diagnostic details through its official channel. Keep passwords, API keys, cookie values and customer information out of public forums. Availability and support scope depend on the actual service/account; do not assume a response deadline.

Pausing Cloudflare or disabling a record's proxy sends web traffic directly to the origin and removes applicable proxy services. It can help isolate a proxy problem only if direct HTTPS and access work. Development Mode is a different option for cache diagnosis while preserving proxy services. Neither action repairs a missing mail record or changes authoritative DNS back.

A nameserver rollback is a separate coordinated DNS migration. Confirm the previous zone still works, contains the required current records and can be delegated through the registrar; reconcile DS/signing and TTL requirements with the operator. Keep both service configurations available until acceptance. Do not promise instant reversal or delete the Cloudflare zone while cached delegation may still use it. For stale-content diagnosis, use our cache-layer guide instead of switching nameservers repeatedly.

What is worth paying for?

Cloudflare offers a Free plan. No paid upgrade is required simply because a WordPress site is being connected in the basic supported flow described here. Begin with the capabilities you actually need and verify current account limits, compatibility and support. Paid options need a specific requirement; a confusing DNS record is not one.

Cloudflare does not replace website backups, host support or cleanup of compromised WordPress files. Read free versus paid WordPress security if you have a separate security gap, or diagnose slow WordPress before upgrading hosting. Buying another product is useful only when it addresses the measured problem and its current scope is clear.

Copy a private setup and verification record

These bracketed fields are deliberately unfilled. This is a template, not a record of a deployment or successful test. Copy it privately and record actual results, including failures and what remains unchecked.

  • Domain, authorized owner and intended benefit: [domain; roles; reason]
  • Registrar/current DNS/host/CDN/mail provider: [account references; responsible contacts]
  • Saved DNS inventory and compared records: [private reference; capture time; unresolved differences]
  • DNSSEC/DS transition and delegation: [supported procedure; TTL/state evidence; operator; time]
  • Origin and edge certificates; proxy choices: [hostnames; observed status; direct-origin recovery limits]
  • Web/login/forms/commerce/mail checks: [test; actual result; time/network; limits]
  • Cache exclusions, rollback trigger and next review: [private configuration reference; owner; action/date]

The useful result is a documented DNS delegation, valid HTTPS and working independent web/email journeys. Improve performance only after that baseline is stable, and measure the change rather than assuming a new dashboard means a better site.