In the following steps replace:
subdomainwith your desired subdomain.domain.comwith your domain.random.herokudns.comwith your Heroku DNS target (see step 1).
-
In the Heroku deployment settings, under domains, click “Add domain”. Enter
subdomain.domain.comto receive therandom.herokudns.comHeroku DNS target. -
In the Heroku deployment settings, under SSL certificates, ensure a certificate is automatically managed. If you don’t do this, attempting to visit
https://subdomain.domain.comin a browser will fail with an SSL error. -
If you already aliased the subdomain to a Zeit Now deployment, use the Zeit Now CLI to remove the alias (I’m not sure what happens if you don’t do this):
now alias rm subdomain.domain.com -
Add the
CNAMEDNS record so that the subdomain will be served by Heroku:now dns add domain.com subdomain CNAME random.herokudns.com
Within 60 seconds your Heroku deployment should serve https://subdomain.domain.com.