Saltar al contenido
Blog

Cloudflare Pages custom domain not working: CNAME, 522, 404

Cloudflare Pages custom domain not working but pages.dev loads? Fix "CNAME not found", 522 and 404 by adding the domain in Pages, then check DNS and proxy.

The Liite team7 min de lectura

Short answer

Add the domain from inside your Pages project (Workers & Pages > your project > Custom domains), not only as a DNS record. Cloudflare's docs say a hand-made CNAME with no domain association in Pages fails to resolve and shows a 522. Then remove any conflicting record on the same name and wait for the status to turn Active.

Your site loads at yourproject.pages.dev, but your own domain shows a 404 "Not Found", a 522, or a "CNAME not found" message in the dashboard. The exact symptom varies, but the cause is usually the same: Pages was never told the hostname belongs to your project.

Why it happens

Most common first:

  1. The domain was never added in Pages. Manually adding a CNAME that points at your Pages site, without first associating the domain in the Pages dashboard, makes the domain fail to resolve at that record and display a 522 error. People on Reddit and Cloudflare's community forum report a 404 "Not Found" from the same setup while pages.dev keeps working. Cloudflare's 522 page lists the same check: if you use Cloudflare Pages, verify that a custom domain is set up and your CNAME points to your Pages domain.
  2. The apex domain isn't a zone on your account. To use a custom apex domain, it must be a zone on the Cloudflare account that holds your Pages project. That means pointing your nameservers at Cloudflare; once that works, Cloudflare creates the CNAME record for you.
  3. A subdomain is managed at another DNS provider. A subdomain doesn't need to be a Cloudflare zone, but you must create a CNAME record yourself at that provider, pointing to <YOUR_SITE>.pages.dev.
  4. A conflicting or leftover record. An older A, AAAA or CNAME on the same name can compete with the one Pages needs. This is general DNS behavior rather than something the Pages docs spell out.
  5. An Enterprise zone hold. If the zone is on the Enterprise plan, release the zone hold before adding the custom domain, because a hold prevents the custom subdomain from activating.
  6. The proxy setting. People report a record stuck or failing because it was proxied when it should be DNS-only, and one community thread (November 2026) reports a proxied record overriding _headers rules. I couldn't confirm either in Cloudflare's docs, so treat them as leads. What the docs do say: with a proxied CNAME, requests pass through your zone first, so your WAF, Redirect Rules, Transform Rules, Cache Rules and Bot Management settings apply. A rule in your zone can therefore change what visitors get.

Step-by-step fixes

Fix 1: Add the domain through Pages

  1. In the Cloudflare dashboard, open Workers & Pages.
  2. Select your Pages project, then Custom domains.
  3. Select Set up a domain.
  4. Enter the domain, for example www.example.com, and select Continue.
  5. If the zone is on Cloudflare, the CNAME record is added automatically after you confirm. If not, create it at your DNS provider (see the table below).
  6. Wait a few minutes, then refresh the status. Test only once it shows Active.

Fix 2: Clean up DNS

  1. Open DNS > Records for the zone.
  2. Look for older records on the same name (the bare domain and www are separate names). Delete anything pointing elsewhere.
  3. Compare the remaining record with what Pages shows for the domain: name, target, proxy status. Don't flip the proxy toggle back and forth; change it once and wait.

Don't leave a hand-made record behind

If you created a CNAME before adding the domain in Pages, it may be the very record causing the 522. Add the domain in Pages first; if the status stays stuck, remove the domain and the record, then add it again.

Fix 3: Re-add the domain

If the status stays on pending, remove the custom domain. Cloudflare's removal steps are: delete your project's CNAME on the DNS Records page, then remove the domain under the project's Custom domains. Wait a moment and add it again through Fix 1.

Fix 4: Rule out a rule in your zone

If the domain is Active but pages behave oddly, such as redirects or missing headers, check Redirect, Transform, Cache and WAF rules on the zone, since they apply to proxied traffic.

Fix 5: Rule out stale caches

Open the site in a private window or flush your local DNS cache, so you aren't seeing an old cached 404 or 522.

What each symptom usually means

SymptomLikely causeFix
522 on custom domainCNAME created without adding the domain in PagesFix 1, then Fix 3
404 "Not Found", pages.dev worksHostname not claimed by the projectFix 1
"CNAME not found"Record missing, on the wrong name, or not propagatedFix 2
Apex domain won't activateDomain isn't a zone on your accountMove nameservers to Cloudflare
Subdomain won't activate (Enterprise)Zone holdRelease the hold first
Headers or redirects ignoredZone rules or proxy setting (unconfirmed)Fix 4

What a 522 means in general: Cloudflare timed out contacting the origin web server. For ordinary sites the causes are firewalls and overloaded servers, but for Pages the missing domain association is the one to check first.

What won't help

  • Waiting longer after making a CNAME by hand. If the domain was never added in Pages, it stays broken.
  • Purging the cache. This is a hostname setup problem.
  • Editing _headers before the domain is Active.
  • Contacting your origin host. A Pages site has no origin server you manage.

Checklist before you try again

  • yourproject.pages.dev loads. If not, the deployment is the problem.
  • The domain appears under the project's Custom domains.
  • Exactly one record exists for the hostname you're testing.
  • A subdomain on another DNS provider points at <YOUR_SITE>.pages.dev.
  • An apex domain uses Cloudflare nameservers.
  • The status shows Active, and you've tested in a private window.

If nothing works

Contact Cloudflare through the dashboard's support options, or post in their community forum. Include:

  • the exact hostname and the error text (or status code);
  • the time you saw it, and the Ray ID if the error page shows one;
  • a screenshot of the project's Custom domains tab and the DNS records for that name;
  • what you already tried.
Hello, my Cloudflare Pages custom domain www.example.com does not work.
yourproject.pages.dev loads fine. The custom domain shows [404 / 522 / "CNAME not found"] since [date, time, timezone].
Ray ID: [ID]
The domain is listed under Custom domains with status [status]. The DNS record is [type, name, target, proxied or DNS only].
I added the domain through the Pages dashboard, removed conflicting records, and re-added the domain once. Please check why the hostname isn't being served by my project.

Common questions

Should the record be proxied (orange cloud) or DNS only?

The Pages docs describe the proxied case, where your zone's rules apply. Use whatever the Pages dashboard creates for the domain and compare against it rather than guessing; reports of the proxy mode causing failures are unconfirmed.

Can I use an apex domain without moving to Cloudflare DNS?

Per Cloudflare's docs, an apex domain must be a zone on your Cloudflare account. A subdomain with a CNAME at another provider works without that.

Why does a CNAME alone not work?

Pages has to associate the hostname with your project; a DNS record only sends traffic to Cloudflare. Without the association, Cloudflare docs say the domain fails and shows a 522.

If you only need a simple site on your own domain

Liite supports a custom domain on Pro and up, one per site, for pages and uploaded HTML or ZIP sites. It has no build pipeline or Git deploys, so it won't replace a Pages project that builds from source. See the custom domains docs.