Configuring branch subdomain names

Is it possible to setup a single site with two branches, and each has a known domain name?

I want master branch to be:
acme-web-app.netlify.com

And staging branch to be something known like:
staging-acme-web-app.netlify.com
or acme-web-app-staging.netlify.com

Traditionally, I have just setup two separate Netlify sites to do this. However, I’m just learning about netlify.toml and used contexts to do a branch deploy of both master and staging – but staging got a generated subdomain.

Thanks!

@paytient, at this time, there is no way to configure branch subdomain names (or site names) in netlify.toml.

For the netlify.com subdomain name, the name will always be the branch name plus to dashes (–) followed by the usual Netlify subdomain domain name. If you had two branches named “dev” and “staging” for the site example.netlify.com, the two branch subdomains would be:

  • dev--example.netlify.com
  • staging--example.netlify.com

This is automatic and cannot be configured.

If you use our Managed DNS service then “dev” and “staging” subdomains will also be automatically created from the primary custom domain. So, if your primary custom domain is example.com, then the two following subdomains will be created:

  • dev.example.com
  • staging.example.com

However, if your primary subdomain was www.example.com, then the subdomains would be:

  • dev.www.example.com
  • staging.www.example.com

This is again is both automatic and not configurable.

If you are using manual configuration to link a domain to a Netlify site, then additional steps are required to get an SSL certificate working for any custom subdomains. They must still follow the naming rules above and must be manually created like all other manual configuration DNS records.