Project addresses
A project-addresses domain gives projects their own addresses under one domain you own. With gallery.example.app, a project called gallery is served at gallery.example.app, as well as at gallery.leafcloud.app.
In the API and the JSON output of leaf domains, this kind of domain is called a platform domain.
Add one
Section titled “Add one”Dashboard: open Domains, choose Add domain, then choose Give projects their own addresses. Pick every project, or choose the projects that should get an address.
CLI, every project of the account, including projects you deploy later:
leaf domains add example.app --project-addresses --all-projectsCLI, only some projects:
leaf domains add example.app --project-addresses --project portfolio --project docsAPI: POST /v1/domains with "kind": "platform". Set "auto_include": true for every project, or give "projects" as a list of {"project": name, "label": label} for chosen ones. label is optional and defaults to the project’s own label.
The command prints the DNS records to create. Add them, then follow Status and checks. The records are in Records to add.
Include every project, or choose projects
Section titled “Include every project, or choose projects”Every project (--all-projects) | Chosen projects (--project) | |
|---|---|---|
| Who gets an address | Every project on the account | Only the projects you list |
| New projects | Get an address at their first deploy | Do not get one until you add them |
| Dashboard | Switch on Automatically include every project, including new ones | Leave it off, and choose the projects on the domain’s page |
| CLI | leaf domains projects <domain> --all-projects on | leaf domains projects <domain> --include <project> |
Turn either mode on or off later:
leaf domains projects example.app --all-projects off # only the projects that have an address now keep oneleaf domains projects example.app --all-projects on # every project gets an addressleaf domains projects example.app --include shop # add one projectleaf domains projects example.app --exclude docs # remove one project's addressTurning automatic inclusion off keeps every address a visitor uses. It lists the projects that had one.
Labels
Section titled “Labels”A project’s label is the first part of its address. The label of gallery on example.app is gallery, so its address is gallery.example.app. Each label is unique on its domain. If a label is taken, choose another one:
leaf domains projects example.app --label gallery=photosThe label changes the address at once. The old address stops, and the new one starts.
API: PATCH /v1/domains/{domain}/projects/{project} with {"label": "photos"}.
The root and www addresses
Section titled “The root and www addresses”A project-addresses domain can also serve the bare domain (example.app) and its www form. Each one is a project, a redirect, or off. Set them with:
leaf domains root example.app --serve portfolioleaf domains root example.app --redirect https://www.example.appleaf domains www example.app --serve portfolioleaf domains www example.app --offOnly a project that has an address on the domain can be served on the root or www address. A project must also have a live deploy.
API: PATCH /v1/domains/{domain} with {"root": {"mode": "serve", "project": "portfolio"}}, {"www": {"mode": "redirect", "redirect_to": "https://www.example.app"}} and so on. The www label is reserved, so no project can use it as a label.
Each of these addresses needs its own record at your DNS provider. leaf domains show lists them. The root record is a CNAME at the domain itself, which many providers do not allow. See DNS providers.
Switch one project off
Section titled “Switch one project off”A project’s address on the domain can be switched off without touching the project:
- In the dashboard, switch the project’s address off with the switch for that domain, on the project’s page or on the domain’s page.
- With the CLI,
leaf domains projects <domain> --exclude <project>. - With the API,
PATCH /v1/sites/{name}with{"platform_domain": false}turns off the project’s address on the account’s first automatic domain.
When it is off, <project>.example.app stops being served. The project’s <project>.leafcloud.app address keeps working. Switch it on again at any time to publish the project’s current deploy there.
Remove the domain
Section titled “Remove the domain”leaf domains remove example.appRemoving the domain unpublishes every project address on it at once. Projects and their leafcloud.app addresses stay. You can add the domain again later.
Related
Section titled “Related”- A domain for one project.
- Limits: how many project-addresses domains an account may have.