Skip to content

Move projects onto a custom domain

Before you begin

Plan
Included in Pro and Team. How plans and limits work
Role
Editor or higher to move a project and Admin or higher to change the workspace default.
You need
  • A verified custom domain in the workspace

Once a custom domain is verified, you can move projects onto it one at a time, and make it the domain new projects start on. A project keeps everything it holds when it moves; only its address changes.

  1. Open the project’s Settings tab.

  2. Under Project details, choose the custom domain in Host. A domain still awaiting DNS is listed with “(unverified)” and cannot be chosen.

  3. Change the Subdomain as well if the project should answer under another name, such as orders for orders.mocks.example.com.

  4. Select Save details.

  5. Read the dialog Move this project to orders.mocks.example.com?. It shows the old and the new addresses with their schemes, and warns when the new address is plain HTTP where the old one was not.

  6. Select Move project.

A message says “Project updated”, and the project’s page lists its new addresses. The project’s mocks, request logs, scenario state and settings are unchanged, and its mocks answer on the new address at once. Webhooks and alert rules that deliver to the project’s own inbox follow it automatically.

The same steps move a project back to a shared domain, or from one custom domain to another.

Moving onto a shared domain from a custom one adds six random characters to the subdomain, such as orders-k3x9p2.mockhub.dev; the dialog shows them as xxxxxx. Moving between two shared domains keeps the subdomain as it is. See Six random characters on a shared domain.

New requests stop reaching the old address as soon as you save; requests already in flight may finish. A request to it then gets 404 with the body Project not found, or fails during the TLS handshake. MockHub cannot update the clients that use it, so change their configuration.

  • Leaving a shared domain: no other workspace can take the old name for 30 days; your workspace can take it back at any time. Clients still calling it during that time reach nothing, and after it they may reach somebody else’s project. See Subdomains on a shared domain.
  • Leaving your own custom domain: the name is free at once for another of your projects. No one outside the workspace can use your domain.

The wildcard record sends a name to MockHub only when your DNS has no record of its own for it. If orders.mocks.example.com already has one, such as an A record for another server, the move succeeds but the project never receives a request there. Check before you move:

Terminal window
dig +short orders.mocks.example.com

The answer should be the wildcard’s target, mockhub.dev., followed by its addresses. Remove any other record for that name at your DNS provider. See Hostnames, domains and protocols.

Make the domain the default for new projects

Section titled “Make the domain the default for new projects”
  1. Open Settings → Workspace.

  2. Choose the domain in Default domain. The list holds the MockHub default and every verified domain the workspace can use; with no such domain, it is replaced by the MockHub default’s name and a link to add a custom domain.

  3. Select Save default domain.

A message says “Default domain saved”, and the domain carries a Default tag under Custom domains. The new-project form now starts on it, and an AI assistant that creates a project without naming a domain uses it too. A project can still choose another domain.

  • Projects move one at a time.
  • The default moves no existing project.
  • If the default domain stops being verified, new projects start on the MockHub default until it is verified again, and Default domain says so.
  • A project on a domain cannot be moved to a subdomain another project already uses there.
  • A project cannot change to a new subdomain on a custom domain that no longer passes both checks, such as one whose ownership record has been missing for seven days. The change is refused with “Domain ownership is not verified. Publish the TXT record shown on the domain and verify it again.”; verify the domain first. Other changes to the project still save.
  • An AI assistant can change a project’s subdomain but not its domain; moving a project to another domain is done in the app.
  • A domain cannot be removed while any project uses it. Move its projects off first.

Report a problem with this page