Choose HTTPS, HTTP or both for a domain
Before you begin
- Plan
- Included in Pro and Team. How plans and limits work
- Role
- Admin or higher.
- You need
- A custom domain in the workspace
Whether a project answers over HTTPS, plain HTTP or both is a setting of its domain, shared by every project on that domain. What the three settings mean is in Which schemes a domain serves; this page changes the setting and says what callers see afterwards.
You choose the setting once when you add a domain, in Protocols, and can change it at any time:
-
Open Settings → Custom domains.
-
On the domain’s row, choose HTTPS only, HTTP and HTTPS or HTTP only in Protocols. The list’s description says what the choice does and that it applies to every project on the domain.
-
Select Save protocols, or Cancel to keep the current setting.
-
When the change allows plain HTTP or stops HTTPS, a dialog asks you to confirm it: Allow plain HTTP on mocks.example.com? or Serve mocks.example.com over HTTP only?. Select Allow HTTP or Switch to HTTP only.
Going back to HTTPS only needs no confirmation.
Result
Section titled “Result”A message confirms the change, such as “mocks.example.com now serves HTTP and HTTPS”, and it applies to every request from then on. Each project’s page lists the addresses it now answers on, with their schemes; use those, never an assumed https://.
What a caller gets under each setting:
| Setting | A request to http:// |
A request to https:// |
|---|---|---|
| HTTPS only | 308 redirect to the same address over HTTPS |
Answered |
| HTTP and HTTPS | Answered | Answered |
| HTTP only | Answered | Fails during the TLS handshake, or, where a certificate was issued earlier, 421 with This domain serves HTTP only. |
The redirect and the 421 are answered before any mock: they are not logged, not counted as usage and not rate limited.
Webhooks and alert rules that deliver to a project’s own inbox follow the setting. With HTTP only they are sent over plain HTTP; with the other two they stay on HTTPS.
Limits
Section titled “Limits”- The setting is per domain, never per project. To serve one project over plain HTTP and keep the rest on HTTPS, put it on a different domain.
- A web page loaded over HTTPS cannot call an
http://address, whatever the mock’s CORS headers say; see HTTP and browsers and A browser cannot call my mock. - MockHub cannot reach into clients. A browser that remembers an HSTS policy keeps using HTTPS after HTTP is allowed: one your main site sent with
includeSubDomains, or one a mock on the domain returned in its own headers. - On a top-level domain that browsers preload as HTTPS-only, such as
.dev, the row warns you when HTTP is allowed. HTTP then works only for clients that allow cleartext, such as servers, devices and command-line tools. - Switching back to HTTPS only redirects plain HTTP requests at once. Clients that do not follow redirects need their addresses updated.
- The shared domains under Provided by MockHub have a fixed setting, shown as a badge next to each.
- Viewers and Editors see a domain’s setting as a badge and cannot change it.