← Building This Site

Part 1

Domains without drama: registrar → Cloudflare → live, no downtime

The four moving parts of putting a domain on Cloudflare — registrar, nameservers, DNS, host — and the order to touch them so the switch is boring. Plus the cache trap that makes a perfect launch look broken.

Pointing a domain at a modern edge host trips people up not because any step is hard, but because four different things — all loosely called "domain stuff" — get conflated. Once you can see them as separate parts, the order to touch them is obvious and the switch is uneventful. This chapter is that mental model, the safe sequence, and the one trap that fools almost everyone at the finish line.

The four parts (most confusion lives here)

4 · Host (what serves the site)

3 · DNS records (the actual answers)

2 · Nameservers (who answers DNS)

1 · Registrar (who you bought it from)

Owns the registration
Sets the nameservers

Points the domain at a
DNS provider's servers

A / AAAA / CNAME / MX / TXT
name → destination

Worker / Pages / server
the thing with your content

  • Registrar — where you bought the name (Porkbun, Namecheap, Cloudflare Registrar…). Its job is the registration itself, and it holds one critical setting: which nameservers are authoritative.
  • Nameservers — the servers that answer "what's the IP for this domain?" Moving to Cloudflare means changing this one setting at the registrar so Cloudflare's nameservers answer instead of the registrar's.
  • DNS records — the answers those servers give: A/AAAA (→ IP), CNAME (→ another name), MX (mail), TXT (verification/SPF). When Cloudflare is your DNS, you manage these in Cloudflare.
  • Host — the thing that actually serves bytes: your Worker, Pages project, or origin server.

The "moving to Cloudflare" everyone talks about is really just part 2: repoint the nameservers. The registration stays put; you don't transfer the domain.

The safe sequence (no downtime)

The trick to a boring switch is doing it in an order where nothing points at nothing.

1 · Add the domain as a zone
in Cloudflare

2 · Let Cloudflare import
existing DNS records

3 · Review records:
delete parking, keep mail/verif.

4 · Cloudflare assigns you
a nameserver pair

5 · At the registrar,
replace nameservers with that pair

6 · Wait for activation
Cloudflare emails you

7 · Attach the domain
to your host

Two ordering choices make it safe:

  • Import DNS before switching nameservers (steps 2–3 before 5). Cloudflare scans your current records and copies them, so the moment its nameservers go live they already know the right answers — no gap. Review that import: kill parking/placeholder records from the registrar's default page, but keep mail (MX) and verification (TXT/SPF) records or you'll silently break email.
  • Attach to the host last (step 7). The custom domain binding on your Worker/Pages needs the zone to exist in the same account first.

If the domain has nothing live on it yet (a fresh registration), the whole thing is zero-risk — there's no traffic to disrupt. That's the ideal time to do it.

What you can't do from the command line

A practical gotcha worth knowing before you script anything: creating a zone is a dashboard / API-token operation, not a CLI one. Cloudflare's CLI auth (the OAuth token your deploy tool uses) is deliberately scoped to deployment — it can read zones but not create them.

can

cannot

needs

CLI / deploy-tool OAuth

deploy workers
read zones
attach custom domains

create a zone

Dashboard, or an API token
with Zone:Create

So "add the domain" is a few clicks in the dashboard (or a scoped API token you mint yourself). Everything after the zone exists — attaching custom domains, deploying — your normal tooling can do. Don't burn time trying to automate the one step that's gated; do it by hand and move on.

The canonical-host decision

While you're setting records, decide your canonical host — apex (example.com) or www — and make the other one a 301 redirect to it. Pick one, redirect the other, always. Splitting traffic and SEO signal across both is a pure-downside mistake.

301

301

www.example.com

example.com

other domains you own

the site

The modern default is apex as canonical, www 301s to it (it's what most big sites do). Where you implement the redirect depends on your host: a redirect rule in the dashboard, or — if you already run middleware — right there in code, which keeps all your routing logic in one place. The principle is host-agnostic: one canonical name, everything else redirects to it.

The trap at the finish line: it's your DNS cache, not a broken launch

Here's the one that fools almost everyone. You finish the switch, the host says live, you load the domain — and you get an error page, or the old parking page. Panic.

Almost always, nothing is wrong. Your computer cached the old DNS answer, and you're still being sent to the previous destination while the rest of the world already sees the new one. DNS changes propagate unevenly; your local resolver is just behind.

Verify with the authoritative answer instead of your cached one:

# What do the real nameservers say right now? (bypasses your local cache)
dig +short A example.com @1.1.1.1

# Hit the site as if DNS already resolved to a specific IP
curl -sI --resolve example.com:443:<that-ip> https://example.com/

If those show the new host while your browser doesn't, you're fine — it's cache, and it clears on its own (minutes, occasionally longer). Quick confirmations: try a different network (phone on cellular), an incognito window, or flush your OS resolver. Don't "fix" a launch that isn't broken — re-doing DNS records out of panic is how you turn a non-problem into a real one.

Yes

No

Not yet

Yes, but wrong record

Domain loads wrong
after the switch

dig @1.1.1.1
shows new host?

It's YOUR cache.
Wait / different network / flush.
Do NOT change records.

Nameservers
actually switched?

Registrar change still
propagating — wait

Now it's a real DNS fix

The scoreboard

What "move to Cloudflare" meansRepoint nameservers at the registrar — not a domain transfer
Safe orderAdd zone → import DNS → review → swap nameservers → activate → attach host
Keep on importMX + verification TXT/SPF · delete registrar parking records
CLI can'tCreate a zone (dashboard / scoped token only); it can deploy + attach
Canonical hostPick apex or www, 301 the other — never split
Launch looks broken?dig @1.1.1.1 first — usually your DNS cache, not a real fault

With the app running on the edge and the domain pointed at it, the last piece is the part that makes a site like this sustainable: the publishing pipeline — how a markdown file becomes a live page with no CMS in sight. That's the next chapter.