DNS and HTTPS Setup for Cloudflare Pages: What to Do
A technical look at DNS records, proxying, TLS modes, DNSSEC and certificate issuance for a custom domain on Cloudflare Pages, with a troubleshooting table.
10 min readUpdated Nov 28, 2026By XPASS Editorial Team

When a custom domain on Cloudflare Pages misbehaves, the symptom is rarely a clear message. You see a browser warning, an endless redirect, a Cloudflare error page or simply an old version of the site. Behind each symptom sits a small number of moving parts: the DNS records, the proxy that answers on Cloudflare's edge, the encryption mode, and the certificate. Knowing how they fit together turns guessing into a short checklist.
This article explains those parts in order. It assumes the site already deploys and loads on its pages.dev address. If you want the step-by-step flow of adding a domain to a project, the connection guide covers it, and here we go deeper into why it works and how to diagnose it when it does not. For comparison with other hosts, the same topics are covered for GitHub Pages, Vercel and Notion Sites. The underlying DNS model is described in RFC 1034, and an overview of HTTPS explains the encryption side in plain terms.
How a request reaches your Pages site
A visitor types your name. Their device asks a recursive resolver, which follows the chain from the root to the top-level domain to your authoritative nameservers. If your zone is managed on Cloudflare, those nameservers are Cloudflare's, and the answer for your name is usually an address that belongs to Cloudflare's network rather than a visible pages.dev target. That is the effect of the proxy: the record is displayed as a CNAME in the dashboard, but resolvers receive Cloudflare addresses.
The browser connects to that address and starts a TLS handshake, announcing the name it wants. Cloudflare's edge presents a certificate for that name, accepts the encrypted request, and routes it to the Pages project that has claimed the name. The project then serves the files from its latest deployment.
Three consequences are worth remembering. First, DNS only delivers the visitor to Cloudflare; the Pages project decides what is shown, so a name missing from the project produces an error page even when DNS is perfect. Second, there are two certificates in the story, the one the visitor sees at the edge, and any connection between the edge and a separate origin server, which matters only if you also run something behind it. Third, because the answer is proxied, a lookup will not show you the pages.dev target, and that is normal.

The DNS records you need
| Goal | Name | Type | Value |
|---|---|---|---|
| Serve a subdomain | www | CNAME | your-project.pages.dev |
| Serve the apex | @ (example.com) | Created for you when the zone is on Cloudflare | Cloudflare flattens the alias at the apex |
| Keep email working | @ | MX, TXT | Unchanged from your email provider |
| Optional certificate policy | @ | CAA | Only authorities you allow, if you use CAA at all |
A few rules keep the zone clean:
- A name with a CNAME must not hold other record types. This is why the apex, which must have SOA and NS records, cannot carry an ordinary CNAME, and why Cloudflare flattens it internally.
- Enter the host part only. If the dashboard appends the domain, typing the full name produces a doubled name such as www.example.com.example.com.
- Do not leave older A, AAAA or CNAME records for the same name pointing to a previous host. Visitors would be split between old and new.
- Leave MX, SPF, DKIM and DMARC records alone. They are unrelated to the website, and deleting them while tidying up is a common way to lose email.
- If you have not registered the name yet, the domains page shows what can be registered.
Check your records from the command line
The dashboard shows what you intended. The command line shows what the world sees. On macOS and Linux use dig; on Windows nslookup does the same job.
- Check the nameservers: dig example.com NS +short. They should be the two that Cloudflare assigned when you added the zone. If you see your registrar's old servers, the switch has not happened or has not spread.
- Check the name: dig www.example.com +short. For a proxied record you will see addresses on Cloudflare's network, which is expected.
- Check without your local cache: dig @1.1.1.1 www.example.com +short and compare with dig @8.8.8.8 www.example.com +short.
- Check DNSSEC: dig example.com DS +short asks the parent zone for a delegation signer record. Compare it with what Cloudflare displays in the DNS settings if you use DNSSEC.
- Check CAA: dig example.com CAA +short. No answer means no restriction; any answer should include the authorities that issue your certificate.
- Check what the server returns: curl -I https://www.example.com shows the status code and any redirect target.
If resolvers disagree, propagation is still in progress and the old answer is cached until its TTL expires. If every resolver gives the same wrong answer, the fault is in the zone itself.
How HTTPS works on Cloudflare Pages
Two layers matter. At the edge, Cloudflare presents a certificate for your name. For a custom domain on Pages, a certificate is issued automatically through an ACME-style process once the name is listed in the project and DNS points correctly. In addition, a zone on Cloudflare normally has a universal certificate that covers the apex and one level of subdomains. A name that is two or more levels deep, such as a.b.example.com, may not be covered by that default and could need an advanced certificate or a flatter structure.
The second layer is the encryption mode between the edge and your origin. For a Pages project the origin is Cloudflare itself, so in most cases you do not configure anything. The mode becomes important if the same zone also serves another site from a separate server. A mode that sends plain HTTP to an origin that insists on HTTPS produces the classic endless redirect, and a strict mode that validates the origin certificate produces an error when that certificate is missing or expired. Use the strictest mode your origin supports for each site, and check the current Cloudflare documentation for the exact options.
Renewal is automatic as long as the DNS keeps pointing at Cloudflare and the domain stays in the project. Problems appear when someone moves the nameservers or removes the domain from the project without realising the certificate depended on it.
Redirects and HTTPS settings
Once the padlock appears, finish the job:
- Pick a canonical address. If the main name is www.example.com, redirect the apex to it with a permanent redirect, and make sure the opposite redirect does not exist anywhere. Two rules pointing at each other cause a loop.
- Turn on the option that redirects all plain HTTP requests to HTTPS, and test both forms in a private window.
- If you enable automatic rewriting of insecure links, still fix the links in your pages. A single image or script loaded over plain HTTP creates mixed content, and browsers block or flag it even when the certificate is valid.
- Consider whether strict transport security fits you. It tells browsers to use HTTPS only for a period, which is useful but hard to undo quickly if you later need an HTTP-only address for a subdomain. Start with a short period and increase it when you are sure.
- Decide what to do with the default pages.dev address. It keeps working, so redirect it to the custom domain or at least make sure canonical tags and your sitemap use only the custom domain.
A worked example: a DNSSEC mismatch
Suppose a shop moves example.shop to Cloudflare. The owner adds the zone, copies the records, sets the new nameservers at the registrar, and adds the custom domain to the Pages project. Some visitors reach the site; others get a resolution error, and a few get nothing at all for hours.
- You run dig example.shop NS +short from two networks and both show Cloudflare's nameservers, so the switch worked.
- You run dig @8.8.8.8 example.shop and receive a server failure status, while a resolver that does not validate DNSSEC returns an answer. That pattern points to DNSSEC.
- You check the registrar and find a DS record left over from the previous DNS provider. It describes keys that Cloudflare does not use, so validating resolvers reject every answer.
- You remove the old DS record at the registrar. If you want DNSSEC with the new provider, you enable it in Cloudflare and add the DS record it displays.
- After the parent zone's cached record expires, the failures stop, and the certificate status in the project becomes active.
The lesson is that a record at a registrar can outlive a provider change. When a failure depends on which resolver you ask, look at DNSSEC before anything else.
Keep a short log of each change with the date, the record and the old value. Weeks later it turns an investigation into a comparison.

Limits and what to watch for
- Moving nameservers moves the whole zone. Recreate every record, especially email, and handle DNSSEC before you switch.
- Pages serves static assets and functions according to the account's plan and the project's settings. Check the current Cloudflare documentation for what is available to you rather than assuming.
- Certificates cover the names configured for the site. A new subdomain must be added to the project; a DNS record alone does not produce a certificate.
- The proxy hides the true target in lookups. That helps privacy of the setup but means you must use the dashboard and the project status to see the intended value.
- CAA records are optional, and a wrong one blocks issuance. If you use them, list every authority that must be able to issue for your name, and test after any change.
- Avoid stacking several redirect layers, such as a registrar redirect, a Cloudflare rule and an application redirect. Each additional layer is another place for a loop.
- A domain that expires stops everything at once, including email. Keep the renewal date in a calendar.
Troubleshooting
| Symptom | First thing to check |
|---|---|
| Error page from Cloudflare on your domain | Is this exact name listed under Custom domains in the project? |
| Too many redirects | Redirect rules pointing at each other, or an encryption mode mismatch |
| Certificate warning | Is the domain active in the project? Any CAA record that blocks issuance? |
| Works on one network, fails on another | Propagation, cached answers, or a DNSSEC mismatch |
| Apex fails, www works | Is the zone active on Cloudflare? Is the apex added as a custom domain? |
| Padlock shows a warning | Search your pages for http links to images, scripts or fonts |
| Email stopped after the move | Compare the zone with your saved copy and restore MX and TXT records |
Work through the table in order. Each symptom has one most likely cause, and the commands above usually confirm it in minutes. If you decide to register or transfer a name for the project, the domains page is a good starting point.
Summary
On Cloudflare Pages, DNS sends visitors to Cloudflare, the project decides which site they see, and the edge certificate protects the connection. Use a CNAME for subdomains, let Cloudflare manage the zone for the apex, keep email records intact and verify real answers with dig instead of trusting the dashboard. Watch for DNSSEC leftovers, redirect loops and mixed content, choose one canonical address, and keep a log of changes. The certificate is issued and renewed automatically while the setup stays in place. When you are ready to pick or manage a name, the domains page is the next step.
Frequently asked questions
Which DNS records does a Cloudflare Pages custom domain need?
A subdomain needs a CNAME pointing at your project's pages.dev address. The apex domain normally requires the zone to be managed on Cloudflare, where the record is created for you when you add the domain. Email records stay unchanged.
Why does my site show too many redirects after adding the domain?
The usual cause is a mismatch between the encryption mode set for the zone and what the origin expects, or a redirect rule that sends visitors back and forth between www and the apex. Use a strict encryption mode where it applies and keep a single redirect direction.
What happens to DNSSEC when I change nameservers?
If the registrar still holds a DS record from your old DNS provider, validating resolvers can fail to resolve the domain. Remove the old DS record before the switch, or turn DNSSEC off first and enable it again with the new provider afterwards.
Does a subdomain several levels deep get a certificate automatically?
Not always. A zone-wide certificate usually covers the apex and one level of subdomains. Deeper names such as a.b.example.com may need an advanced certificate or a different structure, so check the current Cloudflare documentation.
How do I confirm the DNS is correct from the command line?
Run dig for the name and compare the answer with the project instructions. Query a public resolver directly, check the NS and DS records for the domain, and test from more than one network.
References
About the author

Bob Kanokphon Thongdee
- Founder of XPASS VPN
- Co-founder of eSIMonline.asia
- More than 7 years in online marketing
- Founder of Cojourney Visa and Cojourney Travel
Ready to register your domain?
Search a name, compare extensions and pay once for the years you choose.
.com registration from $18.81 for the first year
Search domainsKeep reading

Domain & DNS Guides
DNS and HTTPS Setup for GitHub Pages: What to Do
A focused look at the DNS records, propagation checks and HTTPS certificate steps behind a custom domain on GitHub Pages, plus fixes for the usual errors.
10 min read

Domain & DNS Guides
DNS and HTTPS Setup for Vercel: What to Do
A practical guide to the DNS records and HTTPS settings a Vercel site needs, with checks for certificates, CAA records, redirects and mixed content.
10 min read

Domain & DNS Guides
DNS and HTTPS Setup for Notion Sites: A Practical Guide
What DNS records a Notion Sites custom domain needs, how HTTPS is handled for you, and how to fix verification, redirect and certificate problems.
9 min read