Change a site's domain
Add a domain from an active zone of the site's Cloudflare account, or remove one and add another.
Select Add domain on the site page, then deploy. The domain goes live with that deploy.
Before you start
- You are a Developer, Admin or Owner, or your custom role holds
sites:write. Removing a domain that Cloudflare already serves also needsdeploys:write. See Roles and permissions. - Fleet never changes a linked site, so a linked site has no domain actions.
- The site is Ready to deploy, Setup not finished or Active, and has no domain that is attaching or active.
- The Cloudflare connection is a reusable connection of the workspace. A site whose Cloudflare account came from an End User link starts on its workers.dev address. Add the domain after the End User has granted access.
- The hostname is in an active zone of the Cloudflare account that hosts the site. It is the zone's name or a name ending in a dot and that zone's name. No other site in Fleet holds it. See Cloudflare custom domains.
Steps
- Open the site.
- To replace a domain, select Remove domain and confirm. The site goes back to its workers.dev address. When Cloudflare serves the domain, Fleet starts a deploy that puts that address live, then removes the domain from Cloudflare.
- Wait until that deploy ends. Skip this step if the site has no domain.
- Select Add domain.
- Choose the zone, then type the hostname.
- Confirm. The page shows "<hostname> is attached at the next deploy." with Deploy. Fleet changes nothing in Cloudflare yet.
- Select Deploy. Fleet attaches the hostname and checks
https://<hostname>/_emdash/api/healthevery 30 seconds for up to 15 minutes.
Result
When the hostname answers as an EmDash site, the domain is active and is the site's URL. A rollback to a version that was live with the domain keeps it.
If something goes wrong
Fleet shows one of these messages when you add the domain.
This domain is not an active zone in the connected Cloudflare account. Activate it in the Cloudflare dashboard, then choose it again.
Remove the existing DNS record for <hostname> in Cloudflare, then retry.
- If the hostname does not answer within 15 minutes, the domain shows as failed and the site keeps serving on its workers.dev address. Fix the cause, then select Retry domain. The next deploy verifies it again.
- If the connection to Cloudflare no longer works, the site shows Connection needs reconnecting with Reconnect. See Connection needs reconnecting.
- For zones missing from the list, see Domain is not an active zone. Never send a token, a password or an API key to support.