1

I am using Heroku to host which provides me a nice https: address:

https://some_random_string.herokuapp.com/

I use Namecheap to setup my DNS and I do this using:

CNAME Record | www | www.my_domain.herokudns.com.

I found this information using heroku domains in the macOS bash console.

www.my_domain | CNAME | www.my_domain.herokudns.com

Everything works fine except the s gets dropped off the Heroku address when I use my custom domain.

J S
  • 13
  • 3

2 Answers2

2

According to Heroku Dev Center Custom Domain Names for Apps there's a different pattern for TLS hostnames:

If you’re using the SSL Endpoint, note that your DNS Targets will be a little different. For apps in the Common Runtime, the endpoint domain name will have a name in the form of example-12345.ssl.herokudns.com.

While every app may be served on HTTPS with the default *.herokuapp.com hostname, using your own domain requires a matching TLS certificate. Steps for using own certificates with your apps are described in the SSL Endpoint documentation. In short:

  1. Generate private key & certificate signing request CSR with OpenSSL:

    openssl genrsa -des3 -out server.pass.key 2048
    openssl rsa -in server.pass.key -out server.key
    openssl req -nodes -new -key server.key -out server.csr
    
  2. Purchase a certificate using the CSR.

  3. Create the add-on & add your certificate:

    heroku addons:create ssl:endpoint
    heroku certs:add server.crt server.key --type endpoint
    
Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
0

It is a bit odd that Heroku will provide an https:// address but not allow you to redirect to it.

You might contact their customer support and ask how to setup the CNAME properly so that you can use the certificate they already have created for you.

Changing ...

www.my_domain | CNAME | www.my_domain.herokudns.com

is key to fixing this issue.

clarissa
  • 116
  • 2