Publish a website · Exercise 04
Add a domain
Put your site on your own domain: one you already have, or one you find and buy from the command line with Cloudflare Registrar.
Paste this into your agent
Copied! Now paste it into your agent. No agent yet? Here's how to get one.
Add a domain
Your site works, but something.workers.dev isn’t much of an address. In this exercise you’ll put it on a domain of your own.
There are a few ways to get there, depending on where you’re starting:
- You already have a domain on Cloudflare: you’re a config line away.
- You have a domain somewhere else: you can point it at Cloudflare, which can take up to a day.
- You don’t have one: you can find and buy one from the command line.
- You don’t want one yet: that’s fine. You’ll see what you’d do, and you can come back later.
Find and buy a domain
Cloudflare Registrar sells domains at cost, with no markup, and cf can search for them:
Terminalcf registrar registrations check mysite.com mysite.dev
That tells you which names are available and what each costs, without buying anything. When you’ve picked one, you buy it yourself, in your own terminal:
Terminalcf registrar registrations create mysite.dev
cf checks the price again and asks you to confirm before it charges your account. Your agent will never run this for you: a domain costs real money, and registrations aren’t refundable.
What you’ll build
Your site, served at your own domain as a custom domain, with Cloudflare handling the DNS record and certificate. Your *.workers.dev URL keeps working too.
Prerequisites
- You’ve completed Deploy and still have that project on disk.
- Optionally, a domain name. To buy one, a payment method on your Cloudflare account.