HTTPS/SSL on Heroku with Google Domains as DNS provider

Connor Leech
Employbl
Published in
4 min readOct 18, 2017

--

This might be a bit of a niche share but it is something I struggled with recently. I have a Node.js application hosted on Heroku that I wanted deployed to https://www.mydomain.com. I bought my domain name through Google Domains as the DNS provider.

This means that even if the user puts in http://mydomain.com or http://www.mydomain.com it all needs to end up on https://www.mydomain.com. I’m not trying to belabor the point and it may seem obvious but it was non-trivial for me to set up the first time.

tl;dr — the website is hosted live here: http://www.linemansmilestones.com/ (it’ll forward the URL to the https version of the site)

Step 1: Google Domains

Initially I spent a lot of time messing with Google domains but I didn’t really need to. Here is the configuration I ended up with:

Google Domain DNS config for a heroku app

This is very similar to the official post on Google Domains Help for Map your domain to Heroku however the CNAME record is a bit different and the temporary redirect goes to thehttps:// version of my site.

Step 2: Let’s Encrypt

Update Oct ’17: Steps 2 and 3 could be combined with:

$ heroku certs:auto:enable

These two articles were very helpful for me in setting up the config:

Essentially you need to install certbot with homebrew and then run a command to manually generate a certificate. It sounds that scary but (now that it’s done) it’s not too bad.

$ sudo certbot certonly --manual

--

--

Connor Leech
Employbl

Girl Dad x 2. Cofounder @Employbl. Software Engineer @CommentSold.