Home
Support Forums

How to automatically add new subdomain for a newly branch deployment?

Hi support team

My site is configured to do branch deploy and I could manually add branch subdomain easily by following the instructions in doc. It’s seems to me there is no option to automatically add branch subdomain for every branch deploy. Would you be able to point me to a document that could help answer my question?

EDIT: After adding a subdomain for one branch, any new branch now somehow automatically trigger subdomain addition. Is that the expected behaviour?

Many thanks in advance

hi there compono, can you provide more details on this:

EDIT: After adding a subdomain for one branch, any new branch now somehow automatically trigger subdomain addition. Is that the expected behaviour?

i’m not sure how this is different from what you are hoping to see, and i want to understand a bit better before i respond or ask someone else to respond who can give you a more specific answer. thanks!

So basically after setting the GitHub integration, I can get branch deploy work but the subdomain for the newly deployed branch is not automatically orchestrated so I have to manually do it. But after I have done that, the subsequent deploy now automatically trigger subdomain DNS creation. Perhaps it’s been the intended behaviour?

Hi @compono,

That’s definitely not expected behaviour. Users do have to manually click on the button in the UI for a new branch to be active. Are you still seeing it with newer branches?

It it not what I am seeing. New branch deploys would automatically have subdomains which is good, but I just want to be sure the behaviour is what’s supposed to be so I won’t be caught up in unexpected regression in the future

I have the same problem. Always need to add the first subdomain manually. I thought it was okay

I just tried this myself and I wasn’t able to get a subdomain automatically after I enabled it for the first branch.

Could you share a video or something of this happening?

Now I could not reproduce it anymore. Did anything change on your side? I really need that auto-add subdomain feature, could you please tell your dev team to add checkbox into the UI to toggle this behaviour? OR could you please add an endpoint with netlify API that I could create subdomain myself?

You could check the UI and you’d find out that the branch subdomain feature merely adds a DNS record which you can do with the API:

You can simply add a request to that endpoint and the branch subdomain would work. The only downside to this is that, the UI would not show the branch subdomain as active, but it works as you’d expect it to.