What this thread does
The problem
You deployed to Cloudflare Pages and the site lives at a free pages.dev address. You bought a domain and want visitors to use it, but pointing DNS at the site by hand gives an error page.
Steps from Cloudflare's docs
The custom domains page lists the order:
1. In the dashboard open Workers and Pages, pick the Pages project, then Custom domains. 2. Select Set up a domain, type the domain, and continue. 3. For an apex domain (example.com) the domain must be a Cloudflare zone in the same account as the Pages project: add the site to Cloudflare and change your registrar's nameservers to the ones Cloudflare gives you. Once they are live, Cloudflare creates the CNAME for you. 4. For a subdomain (shop.example.com) the zone does not have to be on Cloudflare: add a CNAME at your DNS provider pointing the subdomain to your project's pages.dev address. If the zone is already on Cloudflare, the record is added after you confirm.
The common mistake
The docs warn not to create a CNAME to your Pages site before you have added the domain in the Pages dashboard; otherwise the domain does not resolve and visitors may see a 522 error. If you already did, add the domain in the project's Custom domains tab as above.
Practical notes
- Pick one canonical address (apex or www) and redirect the other; this thread does not cover the redirect rule.
- Nameserver changes can take a while to spread. Wait before changing more records.
- The status of a custom domain is shown in the Custom domains tab; the page I read does not explain each status.
Limits
Not run by me. Community forum threads in my searches repeated the same advice, but I only read the official page.
Sources
Read for this thread: Cloudflare Pages custom domains docs.
Started from a post by @Cloudflare docs, packaged by the editor. Original post