Updated September 23, 2026 · 12 min read
Connect your own domain to a Cloudflare Pages site: apex vs www, the exact CNAME record, SSL timing, fixes for error 522, and the Workers way.
Short answer: Open your Pages project, select Custom domains > Set up a domain, then point DNS. A subdomain such as www needs one CNAME record to <your-project>.pages.dev, at any DNS provider. An apex domain such as example.com requires moving your nameservers to Cloudflare. SSL is automatic, and the Free plan allows 100 custom domains per project (Cloudflare docs, checked September 2026).
In this guide
- What a Cloudflare Pages custom domain needs before you start
- Apex or subdomain, Cloudflare DNS or not: the four cases
- Step 1: add the domain in the Cloudflare Pages dashboard (always first)
- Path A: connect an apex domain by moving nameservers to Cloudflare
- Path B: connect a subdomain with a CNAME at your current DNS provider
- Cloudflare Pages custom domain DNS records: the exact values
- How long SSL takes on a Cloudflare Pages custom domain
- Redirect www to the apex (and hide the pages.dev address)
- Common Cloudflare Pages custom domain errors and fixes
- The Workers equivalent: a custom domain for a Worker
- What a Cloudflare Pages custom domain costs
- Where sofast fits
- Frequently asked questions
What a Cloudflare Pages custom domain needs before you start
Every Cloudflare Pages project gets a free address ending in .pages.dev. A Cloudflare Pages custom domain replaces it with a name you own, such as juliendesign.com or www.juliendesign.com. The setup takes two moves: declare the domain in the Pages dashboard, then point DNS to your project. Which DNS record you need depends on two questions. Is it an apex domain or a subdomain? And does Cloudflare run your DNS, or another provider?
Imagine a freelancer, Julien, who built a portfolio with an AI assistant and uploaded it to Cloudflare Pages. His domain sits at another registrar, with his email on it, and he must not break that email. If you are still deciding whether Pages is the right host, start with our explainer on what Cloudflare Pages is and what it costs.
One point first. Cloudflare Pages is still supported, but Cloudflare now recommends Workers for new projects. Its Pages docs say: “Start new projects with Workers” (updated August 25, 2026). The Workers way to add a custom domain is covered further down.
In plain terms: An apex domain (also called a root domain) is your bare domain, like example.com. A subdomain adds a prefix, like www.example.com or shop.example.com.
In plain terms: DNS (Domain Name System) is the internet’s address book. Nameservers are the servers that hold your domain’s DNS records, so whoever runs them controls every record, including email.
Apex or subdomain, Cloudflare DNS or not: the four cases
Cloudflare’s custom domains page draws one hard line. For an apex domain, “you will need to add your site as a Cloudflare zone and configure your nameservers.” For a subdomain, “it is not necessary for your site to be a Cloudflare zone” (Cloudflare Pages docs, checked September 2026). This table sums up the four combinations.
| Your domain | DNS on Cloudflare (nameservers moved) | DNS at another provider |
|---|---|---|
| Apex (example.com) | Supported: Cloudflare creates the record for you | Not supported on Pages: move nameservers first |
| Subdomain (www.example.com) | Supported: record added automatically after you confirm | Supported: you add one CNAME to <your-project>.pages.dev |
| Both apex and www | Supported: add both, then redirect one to the other | Only www works; the apex needs Cloudflare DNS |
| Email on the domain | Keep it: review MX records before switching | Untouched: you only add one CNAME |
In plain terms: A Cloudflare zone is a domain added to your Cloudflare account, with Cloudflare answering its DNS. A CNAME (canonical name) record points one name to another name instead of to an IP address.
Use this decision tree to pick your path:
- Do you need the bare domain (example.com) to show the site? If yes, go to step 2. If a subdomain like www is enough, go to step 4.
- Are your nameservers already on Cloudflare? If yes, add the apex in Pages and you are done. If no, go to step 3.
- Can you move your nameservers to Cloudflare? If yes, follow Path A below. If no, use a subdomain and forward the apex at your registrar, if it offers forwarding.
- Is your domain’s DNS on Cloudflare? If yes, add the subdomain in Pages and confirm. If no, follow Path B: one CNAME at your provider.
Step 1: add the domain in the Cloudflare Pages dashboard (always first)
Order matters. Cloudflare warns that adding a CNAME “without first associating the domain (or subdomains) in the Cloudflare Pages dashboard” makes the domain fail and “display a 522 error” (Cloudflare Pages docs, checked September 2026). So always start in the dashboard:
- In the Cloudflare dashboard, go to Workers & Pages.
- Select your Pages project, then Custom domains.
- Select Set up a domain.
- Type the domain you want, for example
www.juliendesign.com, and select Continue. - Follow the screen. If your zone is on Cloudflare, confirm the DNS record it proposes. If it is not, Cloudflare shows the CNAME you need to create elsewhere.
Repeat these steps for each name you want to serve, or add one name and redirect the other (see below).
Path A: connect an apex domain by moving nameservers to Cloudflare
An apex Cloudflare Pages domain only works when the domain is a Cloudflare zone. Once “your nameservers are successfully pointed to Cloudflare, Cloudflare will proceed by creating a CNAME record for you” (Cloudflare Pages docs, checked September 2026). A CNAME at the apex is normally not allowed. Cloudflare solves this with CNAME flattening, which its docs say “is also what allows you to use a root custom domain with a Cloudflare Pages site.”
Email lives in the same DNS, so follow Cloudflare’s full setup sequence (checked September 2026):
- Add the domain to Cloudflare. Go to Domains > Onboard a domain, enter your apex domain, and choose a plan. The Free plan works.
- Review the imported records. Cloudflare can scan your existing records, but it warns the quick scan “is not guaranteed to find all existing DNS records.” Compare them with your current provider, especially MX (mail exchange) and TXT records for email.
- Turn off DNSSEC at your registrar. Cloudflare warns that changing nameservers with DNSSEC active “can cause your domain to become unreachable.” You can turn it back on through Cloudflare later.
- Replace the nameservers at your registrar. Remove the old ones and paste the two Cloudflare nameservers. If they are “not copied exactly,” DNS will not resolve.
- Wait for Active. Cloudflare says to “wait up to 24 hours while your registrar updates your nameservers.” You receive an email when the domain is Active.
- Add the apex in Pages. Run Step 1 with
juliendesign.com. Cloudflare creates the record.
In plain terms: DNSSEC (Domain Name System Security Extensions) signs your DNS records to block spoofing. Old signatures must be removed before a nameserver move, or resolvers reject the new answers.
A shortcut exists for new domains. Domains bought through Cloudflare Registrar, sold at cost, “automatically use Cloudflare for authoritative DNS,” so you skip this whole path (Cloudflare DNS docs, checked September 2026). Our guide on how to buy a domain name compares registrars.
Path B: connect a subdomain with a CNAME at your current DNS provider
If you keep DNS at your registrar, a subdomain is the way. “If you do not want to point your nameservers to Cloudflare, you must create a custom CNAME record to use a subdomain with Cloudflare Pages” (Cloudflare Pages docs, checked September 2026). This is the least risky Cloudflare Pages domain setup, because no other record changes. Your email keeps working.
- Run Step 1 in the Pages dashboard with your subdomain, for example
www.juliendesign.com. - Log in to your DNS provider and open the DNS records for your domain.
- Create a CNAME record for the subdomain, pointing to your project’s
.pages.devaddress. - Delete any older A, AAAA or CNAME record on the same name, such as a parking page.
- Return to Custom domains in Pages and wait for the status to become Active.
Cloudflare’s example puts shop.example.com in the Name column. Many DNS providers only want the prefix (shop or www), so check your provider’s field before saving.
Cloudflare Pages custom domain DNS records: the exact values
These values come from Cloudflare’s Pages and Workers docs (checked September 2026). Replace example.com and <your-project> with your own names.
| Situation | Type | Name | Content | Who creates it |
|---|---|---|---|---|
| Subdomain, DNS elsewhere | CNAME | www (or shop) | <your-project>.pages.dev | You, at your DNS provider |
| Subdomain, DNS on Cloudflare | CNAME | www (or shop) | Filled in by Cloudflare | Cloudflare, after you confirm |
| Apex, DNS on Cloudflare | CNAME (flattened) | example.com | Filled in by Cloudflare | Cloudflare, automatically |
| Apex, DNS elsewhere | None | — | Not supported on Pages | Move nameservers (Path A) |
| www redirected to apex | A, Proxied | www | 192.0.2.1 | You, plus a Bulk Redirect |
| Only if you restrict certificate issuers | CAA | example.com | 0 issue "letsencrypt.org", 0 issue "pki.goog; cansignhttpexchanges=yes", 0 issue "ssl.com" | You, plus matching issuewild lines |
No A record points to Cloudflare Pages in a normal setup. The only A record above is a redirect placeholder: because it is proxied, Cloudflare applies the redirect before traffic reaches 192.0.2.1.
In plain terms: A CAA (Certification Authority Authorization) record lists which certificate authorities may issue SSL certificates for your domain. Most small sites have none, and then any authority may issue.
How long SSL takes on a Cloudflare Pages custom domain
You never upload a certificate for a Cloudflare Pages custom domain. Cloudflare issues it once DNS points to the project. The timing has three layers, and each has an official figure (Cloudflare docs, checked September 2026).
- Nameserver switch (Path A only): up to 24 hours for your registrar to update the nameservers.
- Domain verification in Pages: the domain shows Verifying, then Active. Cloudflare’s debugging page says to seek help if it is “still verifying after 15 minutes” once blockers are removed.
- Zone certificate after activation: Universal SSL reaches a newly active zone “within 15 minutes to 24 hours,” depending on checks the certificate authorities require.
Cloudflare’s Universal SSL certificates have “a 90-day validity period,” and “the auto renewal period starts 30 days before expiration.” You do nothing as long as DNS still points to Cloudflare. For the basics, read our guide to SSL certificates explained.
In plain terms: An SSL/TLS (Secure Sockets Layer / Transport Layer Security) certificate encrypts traffic between visitors and your site. It gives you the padlock and “https://”.
Redirect www to the apex (and hide the pages.dev address)
Pick one main address and redirect the other. Cloudflare’s how-to for Pages uses Bulk Redirects (checked September 2026):
- Go to Bulk Redirects in the dashboard and create a list.
- Add a row: source
www.example.com, targethttps://example.com, status301. - Tick Preserve query string, Subpath matching, Preserve path suffix and Include subdomains.
- Create a Bulk Redirect rule that uses this list.
- In DNS, add an A record: name
www, IPv4192.0.2.1, proxy status Proxied.
This needs your DNS on Cloudflare, so it fits Path A. Your project also stays reachable on its .pages.dev address. Cloudflare suggests the same Bulk Redirect feature to send that address to your custom domain, which avoids two public copies of one site.
Common Cloudflare Pages custom domain errors and fixes
Most problems fall into six cases.
Error 522 right after adding the CNAME
Error 522 means Cloudflare timed out reaching an origin. For Pages, Cloudflare’s 522 page says to “verify that you have a custom domain set up and that your CNAME record is pointed to your custom Pages domain.” The usual cause is a CNAME created before the Cloudflare Pages custom domain was added in Step 1. Add the domain under Custom domains in the project, then wait for Active.
Cloudflare Pages domain stuck on “Verifying”
Pages “uses HTTP validation and needs to hit an HTTP endpoint during validation.” Cloudflare Access, a redirect rule or a Worker on the hostname can block it. Test with curl -s -o /dev/null -D - https://example.com/.well-known/acme-challenge/randomstring. A redirect in the answer means something intercepts the request. Pause it until the domain is verified. Next, check CAA records with dig CAA example.com and add the issuers from the table above. Enterprise zones may also have a zone hold to release.
The site works on pages.dev but not on the custom domain
A proxied (orange cloud) record applies your zone settings, such as caching, to the site. Cloudflare’s debugging page gives two checks. Remove any Page Rule with Cache Everything, “as Pages handles its own cache.” If errors persist, set the project’s DNS record to DNS Only (grey cloud) and review your zone configuration.
Errors after pointing DNS away and back
If you point the record elsewhere, Cloudflare warns that “the custom domain will become inactive.” Pointing it back causes errors until it is active again. For a temporary switch, use an Origin rule or a redirect rule instead.
Error 1014 “CNAME Cross-User Banned”
Cloudflare’s CNAME flattening docs state that a “CNAME to a different Cloudflare account is prohibited.” Keep the Pages project and the zone in the same Cloudflare account, as the Pages docs require for an apex domain.
Email stopped after the nameserver move
The quick scan missed a record. Copy every MX and TXT record from your old DNS provider into Cloudflare, with proxy status DNS only. Cloudflare’s setup guide lists MX records and the TXT records that authenticate your email as the ones to review.
The Workers equivalent: a custom domain for a Worker
Cloudflare’s Pages docs call Workers “Cloudflare’s primary platform for building applications.” A Worker with static assets gets a Custom Domain in five steps (Cloudflare Workers docs, updated August 14, 2026):
- In the Cloudflare dashboard, go to Workers & Pages.
- In Overview, select your Worker.
- Go to Settings > Domains & Routes > Add > Custom Domain.
- Enter the domain or subdomain.
- Select Add Custom Domain. Cloudflare creates the DNS record and the certificate.
Two rules differ from Pages. First, a Worker needs “an active Cloudflare zone.” Cloudflare’s migration guide is blunt: “Unlike Pages, Workers does not support any domain whose nameservers are not managed by Cloudflare.” Second, “you cannot create a Custom Domain on a hostname with an existing CNAME DNS record.” Delete that CNAME first.
| Point | Cloudflare Pages | Cloudflare Workers |
|---|---|---|
| Apex domain | Needs Cloudflare nameservers | Needs Cloudflare nameservers |
| Subdomain with DNS elsewhere | Yes, with a CNAME to .pages.dev | No |
| DNS record | Created for you on a Cloudflare zone | Created for you |
| Certificate | Issued automatically | Advanced Certificate, not deleted with the domain |
| www and apex together | Add both, or Bulk Redirect | Exact match only: redirect rule plus proxied A record to 192.0.2.0 |
The full trade-off is in our comparison of Cloudflare Pages vs Workers for a static site.
What a Cloudflare Pages custom domain costs
Connecting a Cloudflare Pages custom domain costs nothing on Cloudflare’s side. Cloudflare’s Pages product page states: “All plans come with unlimited sites, seats, requests, and bandwidth.” The limits page caps custom domains per project: 100 on Free, 250 on Pro and 500 on Business (updated September 5, 2026). You pay only for the domain name, at your registrar or at cost through Cloudflare Registrar.
The site itself is limited to 20,000 files and 25 MiB per file on Free (Cloudflare docs, checked September 2026). For how Cloudflare compares with the other big free hosts, read Vercel vs Netlify vs Cloudflare Pages. If you use GitHub instead, the steps differ: see our GitHub Pages custom domain guide.
Where sofast fits
sofast hosts static HTML sites by drag-and-drop upload: no Git, no command line, automatic SSL, and a free plan with 50 MB and a sofast subdomain, not listed on Google. It is built on Cloudflare’s global network, but it does not run on Cloudflare Pages. It targets people like Julien, who have a finished HTML/CSS site and want it online in about 15 seconds, as sofast says.
The honest part: Cloudflare Pages lets you connect a custom domain for free, with up to 100 per project. sofast’s Free plan does not include custom domains. They start on Starter at $5 per month billed annually ($6 billed monthly). Pro is $10 and Large $20 per month, billed annually. Commercial use is allowed on sofast Free.
sofast has other limits. There is no Git workflow, no build step and no server-side code. Unknown paths return a 404, with no single-page-app fallback. It is a new, pre-launch service. What it removes is the DNS decision tree above: on paid plans, a guided setup shows which record to create, and SSL is issued automatically. Compare plans on the sofast pricing page.
Frequently asked questions
Yes. Every Cloudflare Pages project can use custom domains, on every plan. The limits page allows 100 custom domains per project on Free, 250 on Pro and 500 on Business (Cloudflare docs, checked September 2026). You add the domain in Workers & Pages > your project > Custom domains > Set up a domain. Then you point DNS: a CNAME for a subdomain, or Cloudflare nameservers for an apex domain.
Yes. Connecting a custom domain to Cloudflare Pages costs nothing, and the SSL certificate is free and automatic. The Free plan allows 100 custom domains per project. You still pay for the domain name itself, at any registrar or at cost through Cloudflare Registrar. Moving your nameservers to Cloudflare also works on Cloudflare’s Free plan (Cloudflare docs, checked September 2026).
Yes, for a subdomain only. Keep DNS at your provider and add a CNAME record, for example www, pointing to your-project.pages.dev. Add the domain in the Pages dashboard first, or the site shows error 522. An apex domain like example.com requires Cloudflare nameservers. Cloudflare Workers is stricter: it supports no domain whose nameservers are outside Cloudflare (Cloudflare docs, checked September 2026).
For a subdomain with DNS outside Cloudflare, create a CNAME: name www (or another prefix), content your-project.pages.dev. On a Cloudflare zone, Pages creates the record for you after you confirm, including a flattened CNAME for the apex. You do not add an A record pointing to Pages. The only A record in Cloudflare’s docs is a proxied placeholder, 192.0.2.1, used for a www redirect.
Check four causes. Error 522 usually means the CNAME exists but the domain was never added under Custom domains. A domain stuck on Verifying often has Access, a redirect or a Worker blocking HTTP validation, or restrictive CAA records. If only the custom domain fails, remove any Cache Everything Page Rule. Finally, confirm the Pages project and the zone are in the same account.
It depends on your setup. A nameserver change can take up to 24 hours. Cloudflare says a domain still Verifying after 15 minutes, once blockers are removed, needs support. A newly active zone receives its Universal SSL certificate within 15 minutes to 24 hours. Certificates are valid 90 days and renew automatically, starting 30 days before expiry (Cloudflare docs, checked September 2026).
No official page says Pages is deprecated. Cloudflare still supports it, but its Pages docs now say: “Start new projects with Workers” (updated August 25, 2026). In April 2025, Cloudflare wrote that all future “investment, optimizations, and feature work will be dedicated to improving Workers.” Existing Pages sites and their custom domains keep working. New projects are better started on Workers.
Cloudflare Pages allows 100 projects per account, a limit “not routinely increased,” according to its limits page (checked September 2026). Each project can carry 100 custom domains on the Free plan. The product page also says all plans include unlimited requests and bandwidth. Each site is limited to 20,000 files, and 25 MiB per file.
Sources
- Cloudflare Pages Docs — Custom domains (updated 2026-04-21)
- Cloudflare Pages Docs — Debugging Pages (pages.dev vs custom domains, domain stuck in verification, CAA, zone holds; updated 2026-06-02)
- Cloudflare Pages Docs — Redirecting www to domain apex (updated 2026-04-21)
- Cloudflare Pages Docs — Overview, “Start new projects with Workers” (updated 2026-08-25)
- Cloudflare Pages Docs — Limits (custom domains per project, projects, files; updated 2026-09-05)
- Cloudflare Pages Docs — Direct Upload (updated 2026-04-21)
- Cloudflare Pages product page
- Cloudflare Workers Docs — Custom Domains (updated 2026-08-14)
- Cloudflare Workers Docs — Migrate from Pages to Workers (custom domains note; updated 2026-09-22)
- Cloudflare DNS Docs — Set up a primary zone (Full setup) (updated 2026-07-29)
- Cloudflare DNS Docs — CNAME setup (Partial) (updated 2026-08-14)
- Cloudflare DNS Docs — CNAME flattening (updated 2026-06-24)
- Cloudflare SSL Docs — Enable Universal SSL certificates (updated 2026-04-16)
- Cloudflare Support — Error 522 (updated 2026-07-31)
- Cloudflare blog — Full-stack development on Cloudflare Workers (2025-04-08)
- All checked September 23, 2026.
Start free — no credit card required → Create your free site