Choose a hostname
Before you begin
- Role
- Editor or higher.
A project’s hostname is its Subdomain on a Host: orders-api on mocks.example.com answers at https://orders-api.mocks.example.com. On a shared domain such as mockhub.dev, MockHub adds six random characters to the subdomain, so orders-api answers at an address such as https://orders-api-k3x9p2.mockhub.dev.
How subdomains, shared and custom domains and schemes fit together is explained in Hostnames, domains and protocols; this page is about picking the name.
What a subdomain can be
Section titled “What a subdomain can be”| Rule | What to know |
|---|---|
| Lowercase letters, digits and hyphens | Not starting or ending with a hyphen. The field turns capitals into lowercase as you type. |
| At least as long as your plan requires | The hint under Subdomain says how long, such as “At least … characters”. The limits page lists it per plan. |
| Not taken on that domain | A taken name is refused with A project with this host already exists. |
| Not reserved | Names MockHub keeps for itself, such as api, www, admin, login, mail, test, dev, staging and demo, are refused. |
A reserved name is refused when you save, with a message naming it:
"admin" is reserved and cannot be used as a subdomain.The form checks the length as you type, so a reserved name shorter than your plan’s minimum, such as api, shows the length hint instead.
A name another workspace gave up recently is refused until the date in the message; Hostnames, domains and protocols explains why.
Six random characters on a shared domain
Section titled “Six random characters on a shared domain”Everyone shares a domain such as mockhub.dev, so a name chosen there exactly could be claimed first by someone else, or made to look like another company’s. MockHub therefore adds a hyphen and six random characters to every subdomain you choose on a shared domain: orders-api becomes orders-api-k3x9p2. The characters leave out 0, o, 1 and l, which are easy to confuse when read aloud.
| When | What happens |
|---|---|
| You create a project on a shared domain | The subdomain gets six random characters. The preview shows them as xxxxxx. |
| You create a project on your workspace’s custom domain | The subdomain is used exactly as you type it. |
| You save the project’s Settings without changing the subdomain | Nothing moves. The subdomain keeps the characters it has. |
| You change the subdomain on a shared domain | The new subdomain gets six new random characters. |
| You move a project from a custom domain onto a shared domain | Its subdomain gets six random characters. |
| You move a project from one shared domain to another | Its subdomain stays as it is. |
The length and reserved-name rules above apply to what you type, before the characters are added. The project’s page shows its full address once it exists. For an address without the characters, put the project on a custom domain.
Nested subdomains
Section titled “Nested subdomains”On Pro and Team, a subdomain can have several parts separated by dots: payments.shop answers at https://payments.shop.mockhub.dev. Each part must meet the minimum length and must not be reserved on its own. The form checks the length of the whole name only, so a part that is too short is refused when you save, with “Each subdomain part must be at least … characters long”.
Choose it when you create a project
Section titled “Choose it when you create a project”-
On the New project page, enter a Subdomain that says what the project stands in for, such as
orders-api. Suggest fills in a random name, such asswift-river-481, if you do not need a meaningful one. -
Choose the Host. The workspace’s default comes first, then MockHub’s shared domains, then your workspace’s custom domains, each with the schemes it serves, such as
mockhub.dev · HTTPS · default. -
Check the addresses under Requests will be answered at.
On a shared domain the address shows
xxxxxxwhere the six random characters go, such ashttps://orders-api-xxxxxx.mockhub.dev. They are chosen when the project is created. -
Select Create project.
Change it later
Section titled “Change it later”Changing the subdomain or the host moves the project to a new address. Anything still calling the old one stops reaching it.
-
Open the project’s Settings tab.
-
Under Project details, change the Subdomain.
-
Select Save details.
-
Read the dialog, titled with the new address, such as “Move this project to orders-v2.mockhub.dev?”. It lists the old and the new addresses in full.
On a shared domain the new address shows
xxxxxxwhere the new random characters go, such as “Move this project to orders-v2-xxxxxx.mockhub.dev?”. -
Select Move project.
Choosing another Host in step 2 works the same way; Move projects onto a custom domain covers it, and what happens to the old address.
Result
Section titled “Result”A new project answers at the addresses the preview showed, and lists them under its name. After a move, MockHub shows Project updated, and the project’s page shows its new addresses. New requests to the old address no longer reach the project; requests already in flight may finish. Webhooks and alert rules that deliver to this project’s own inbox follow it to the new address.
Limits
Section titled “Limits”- MockHub cannot update the clients that call a project. Change their configuration when you move it.
- A subdomain on a verified custom domain that your DNS also points elsewhere never receives traffic, and MockHub does not detect it. See Hostnames, domains and protocols.