Skip to content

Instantly share code, notes, and snippets.

@jaydenseric
Created December 29, 2019 09:59
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaydenseric/f4147d7d9788d1f46b30e4ac7b57e6b2 to your computer and use it in GitHub Desktop.
Save jaydenseric/f4147d7d9788d1f46b30e4ac7b57e6b2 to your computer and use it in GitHub Desktop.
How to use a Zeit Now subdomain with a Heroku deployment.

How to use a Zeit Now subdomain with a Heroku deployment

In the following steps replace:

  • subdomain with your desired subdomain.
  • domain.com with your domain.
  • random.herokudns.com with your Heroku DNS target (see step 1).
  1. In the Heroku deployment settings, under domains, click “Add domain”. Enter subdomain.domain.com to receive the random.herokudns.com Heroku DNS target.

  2. 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.com in a browser will fail with an SSL error.

  3. 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
    
  4. Add the CNAME DNS 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment