SSL for branch subdomains

Hi !

My website site name is : coucool.netlify.app
I’m trying to configure my website on Netlify to make it work in the following way :

  • My develop branch pointing to : develop.cou.cool (staging)
  • My main branch pointing to : cou.cool (production)

My cou.cool domain is registered on an external DNS (and I can’t use Netlify DNS). I just added the A entry to my external DNS to point to Netlify load balancer.
I also added a CNAME entry to setup my staging subdomain like so : develop 3600 IN CNAME develop—coucool.netlify.app. (by reading your documentation).

I have 3 questions :

  • Is everything okay in my setup ?
  • Could you please setup SSL for my develop.cou.cool subdomain ?
  • If your answers to my first 2 questions are positive, does that mean that pushing to develop branch will automatically update my staging website and pushing on my main branch will do the same on production (which is exactly what I want) ?

Thanks a lot,

Hiya @yonitou !

Seems like DNS is optimally setup to me! I can also see that somehow you already (perhaps with someone else’s help?) got the branch subdomain into the certificate so I think we’re all set here - the site should show production build on cou.cool and your staging build on develop.cou.cool - but please let me know if that’s not what you are seeing, or if I can help with anything else!

Hi @fool ,

Thanks for your answer :slight_smile: You’re right, one of your teammates setup the certificate for develop.cou.cool.

The only left issue is that I want to redirect www.develop.cou.cool to develop.cou.cool and I don’t find the proper way to do it. Could you help ?

Thanks !

Hi @yonitou :wave:t6: , welcome back to the forums! Please can you give this handy link a read to see if you can setup this redirect on your own?

Once setup and configured you will be able to manage, declare and add to redirect with netlify.toml

If you are still having issues please share your site name, where you are getting stuck and more details on what you are need help with? Screenshots will be helpful.

Hey @SamO

I’m not sure to understand … I’m already using static redirects with the _redirects file in my website but I’m not sure it can work for what I’m asking.
To be more precise : My staging website is correctly hosted at develop.cou.cool. I want that www.develop.cou.cool redirects to develop.cou.cool (www to non www). For me, it should be done in my DNS provider but I’m not sure what the CNAME entry should be. Do you understand better what I want ?

My site name is coucool.netlify.app
Thanks again,

Sam’s advice was one piece of how to fix it on our system - you could fix it at your DNS provider but we really don’t recommend it. Here’s what I’d do in great detail:

  1. add a new domain alias for www.develop.cou.cool here: Netlify App
  2. configure it same as www.cou.cool in your DNS provider (CNAME to same site)
  3. then create the redirect Sam was mentioning, and deploy it. Note: this should go at the very top of your _redirects!

https://www.develop.cou.cool/* https://develop.cou.cool/:splat 301!

Hi @fool
Sorry for the very late follow-up.

Thanks for your answer.

I did exactly what you said and it’s “almost” working. To be clear :

  • The redirection is working
  • But when I try to access to https://www.develop.cou.cool, my browser (Chrome) is yelling because the SSL certificate is not valid (you can try it on your side). Did I miss something ?
    I think we’re not far from the solution :slight_smile:

Thank again,

Yoni

Hi @yonitou ,

You’re all set! The subdomain www.develop.cou.cool has been added to your site’s SSL certificate. It’s been tested and is loading successfully & securely in my browser :tada:

Oh okay ! I didn’t understand that you had something to do on your side when I read the last answers.

Thanks a lot then, I’ll keep you in touch if I have some issues :slight_smile:

Sounds good. Thank you.