# Custom domain

> Give your Cloudflare Zugoid Server its own domain, choose the primary address, and add or remove aliases without breaking existing links.

Source: https://zugoid.com/docs/cloudflare/custom-domain

A new Cloudflare Server starts on its `workers.dev` address. You can add your own domains at any time. A Server can answer at several addresses:

- The **primary address** is used for new links and background email.
- **Aliases** are additional addresses. They reach the same Server, with the same UUID, Accounts and content.

Every listed address works for login, sessions, links, uploads, MCP and realtime. Adding an address never disables the others, and the `workers.dev` address always stays enabled.

## Before you start

- The domain must be **active in the same Cloudflare account** as the Server. See [Get a domain](#get-a-domain).
- The hostname must not already be attached to another Worker.
- You must be the Owner.

## Get a domain

Open [Domains in your Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/domains/overview), using the account that holds the Server.

- **To buy a new domain,** register it there. Cloudflare charges the payment method on the account, and registrations are not refundable. The domain is active straight away. Check that auto-renew is on.
- **To use a domain you already own,** select **Onboard a domain** and follow the steps. They end with changing the nameservers at your current registrar. Wait until Cloudflare shows the domain as **Active**, usually a few minutes and up to a day.

When the Server keeps Cloudflare access, the **Server address** page lists the active domains in the account and links to this page when there are none.

## Add an address

1. In your Server, open **Server settings → Deployment → Domain**. The page is titled **Server address**.
2. Select **Add address**.
3. If the page lists **Cloudflare domain**, choose the domain. In **Domain**, keep it or put a subdomain in front, for example `chat.example.com`.
4. Optional: check **Make this the primary address**. The current primary stays available as an alias.
5. Confirm:
   - If the Server keeps Cloudflare access, select **Add address**. The Server attaches the domain itself.
   - Otherwise, select **Continue to Cloudflare**. The official installer opens on zugoid.com; select **Connect Cloudflare**, sign in to the account that owns the Server, then select **Apply the change**. Keep the window open until it finishes, then select **Return to Server settings**.

[Screenshot: The Server address settings with the Addresses list showing a workers.dev address marked Always available, a custom domain marked Primary, and the Add address form with the Domain field (Server settings → Deployment → Domain)]

The installer attaches the hostname as a Worker custom domain in your zone. Cloudflare creates the DNS record and certificate for it.

The **Requests** list on the same page shows each change and whether it completed or failed, with the reason.

## Change the primary address

On an alias, select **Make primary**. The old primary stays as an alias, so existing links keep working.

New links and background email then use the new primary. People using an older address keep reaching the Server.

## Remove an alias

On an alias, select **Remove**. This detaches the custom domain from the Worker.

You cannot remove the primary address. Make another address primary first. The `workers.dev` address is marked **Always available** and cannot be removed here.

> [!WARNING]
> Links, browser bookmarks, Server list entries and MCP clients that use a removed address stop working. Make sure people use the primary address before you remove an old one.

## Without kept Cloudflare access

If the Server does not keep Cloudflare access, every add, promote or remove goes through the official installer. The Server creates a single-use request; the installer applies it with your one-time Cloudflare authorization. The Server never receives an account-wide credential this way. See [Cloudflare access](https://zugoid.com/docs/cloudflare/access.md).

## Things to check

- **Only listed addresses are trusted.** A hostname that merely reaches the Worker, without being listed, is rejected for sessions and changes. It is never added automatically.
- **External sign-in providers.** If you use GitHub, Google or another login provider in **Server settings → Authentication**, allow its callback URL on each address you enable there.
- **Zone features that rewrite scripts.** Features that inject or rewrite inline scripts, such as Rocket Loader, are incompatible with the Server's Content-Security-Policy. Keep them off for the Server's hostnames.

## Related

- [Mail](https://zugoid.com/docs/cloudflare/mail.md)
- [Servers](https://zugoid.com/docs/concepts/servers.md)
