Skip to content

Add and verify a custom domain

Before you begin

Plan
Included in Pro and Team. How plans and limits work
Role
Admin or higher.
You need
  • Access to the DNS records of the domain

A custom domain lets the workspace’s projects answer under a name you own, such as orders.mocks.example.com, instead of a subdomain of a MockHub domain. How the two checks behind it work is explained in Hostnames, domains and protocols.

Choose a name you can dedicate to mocks, such as mocks.example.com rather than example.com: the wildcard record you publish sends every name under it that has no record of its own to MockHub.

  1. Open Settings → Custom domains. Settings is in the account menu, which shows your name in the page header.

  2. Select Add domain, and in Add a domain enter the name in Domain name, such as mocks.example.com. A pasted address such as https://mocks.example.com/ is trimmed to the name.

  3. Choose the schemes its projects answer on in Protocols. HTTPS only is preselected; see Choose HTTPS, HTTP or both for a domain before choosing another.

  4. Select Add domain in the dialog. The domain appears in the list tagged Awaiting DNS, with its DNS setup open.

  5. Publish the two records the DNS setup shows, a TXT record and a wildcard CNAME record, at your DNS provider. Configure DNS for a custom domain goes through each one.

  6. Once the records are live, select Verify on the domain’s row. DNS changes can take up to 24 hours to spread.

A message says “mocks.example.com is verified” and “Projects can use it now.” The domain’s tag changes to Verified, and its row reads “Ownership (TXT record): proven” and “Traffic (wildcard CNAME record): reaches the gateway”.

The domain now appears in the Host list when you create a project, and existing projects can move onto it; see Move projects onto a custom domain.

If a check fails, the message says “mocks.example.com is not verified yet” and names the record MockHub could not see, such as “The ownership TXT record is not visible to us yet.”, and the DNS setup opens again. Nothing is lost: fix the record and select Verify again. When it still fails, see My domain does not verify.

MockHub also checks both records the moment you add the domain. The TXT record cannot exist yet, because its value is created then, so a new domain always starts as Awaiting DNS.

  • Verification runs when you add the domain and when you select Verify, which stays available after both checks pass. The TXT record is also checked again every day.
  • When a daily check, or Verify, no longer finds the TXT record, the row warns “The ownership TXT record was not found when it was checked again. Publish it again; otherwise projects on mocks.example.com stop answering on” and the date, seven days later. Until then the domain keeps working; Verify says “mocks.example.com is missing its ownership record” and that its projects still answer. Publishing the record again ends the warning at the next check.
  • If the record is still missing on the date the warning names, ownership is no longer proven and the domain’s projects stop answering from then, even before the next daily check. Publish the record and select Verify to prove it again.
  • A workspace runs one DNS check at a time. Add domain or Verify while another check in the workspace is running, in another tab or by another Admin, is refused with “Another domain check in this workspace is still running. Try again in a few seconds.” After 30 checks in 10 minutes, adding domains included, the next is refused with “Too Many Requests” for up to 10 minutes.
  • The plan sets how many custom domains a workspace can have; the Custom domains heading shows how many are used, and once the limit is reached Add domain is dimmed and selecting it says “No more custom domains” instead of opening the dialog. See the limits page.
  • A domain belongs to one workspace. A name another workspace has proven ownership of, or one above or below it, is refused, and so is a public suffix such as co.uk; names under MockHub’s own domains are reserved. Another workspace’s unverified claim does not block a name: the first workspace to verify ownership holds it, so Verify can be refused if another workspace gets there first. See The domain cannot be added.
  • Nothing is served at the domain itself. A project’s address is always a subdomain of it, such as orders.mocks.example.com.
  • Each project’s address gets its certificate the first time it is called over HTTPS. Certificates are published in public Certificate Transparency logs, so the names of your projects are not secret.
  • To remove a domain, select Remove mocks.example.com on its row and confirm with Remove domain. This is refused while any project uses the domain, with the number of projects still on it: move them first. It is also refused while a deleted project that support can still recover used it, naming the date it is deleted permanently; ask support to delete it sooner if you need the domain gone before then. Removing the domain chosen as the workspace default returns new projects to the MockHub default.
  • Adding a domain again after removing it creates a new TXT value, so the old TXT record has to be replaced.
  • Viewers and Editors see the list of domains and their state, but not the DNS setup or the controls.

Report a problem with this page