Auto Deploy to Branch Sub Domain

I have set up netlify with a custom domain - so far so good - but I was wondering is it possible to automatically do a Branch deploy to a custom domain?

Currently if I push a branch to my repository, the branch is deployed at https://<GIT_HASH>--infarm-dev.netlify.com. Is it possible for the branch to automatically be deployed to https://<BRANCH_NAME>.infarm.dev? Currently I have to go to the domain management in the settings and manually add it, which I would like to avoid.

Many thanks.

The last successful build of your branch (usually that corresponds with your last commit on that branch) will be automatically served at branchname.yourcustomdomain with no further action by you; we serve as soon as it is built. The only challenges are 2:

  1. in the SSL certificate. If you already have an SSL certificate (which you do for *.infarm.dev, see here: Netlify App) then this is not a blocker.
  2. then you just need to add the DNS records, which you could do in advance (add every branch name preemptively here: Netlify App), or you could set some “default” *.infarm.dev record as a CNAME pointing to yoursitename.netlify.com and then automatically, branchname.infarm.dev will map to the right place and “just work”

You could avoid even that

Hello!

Thanks for your help.

I added the *.infarm.dev CNAME record as you suggested and I am now able to access my deployed branches by their names, without having to do any extra steps in the UI, which is great.

The only thing is that the Preview deploy link on the builds page still links to the url on the netlify subdomain 5e79debc13cbf20008d0bbce--infarm-dev.netlify.com. Is there any way to change that or is that the kind of thing I should be making a feature request for?

Hello!

Thanks for your help. I followed your suggestion of adding a CNAME with a wildcard and it does miraculously “just work” so thank you :slight_smile: