2

I just purchased a new domain in GoDaddy lets call it example.com. I want to connect this domain to my Heroku app, so I went to the settings in Heroku and under Domains section I added the followings options for my domain:

  1. www.example.com
  2. example.com

Then, in GoDaddy, under DNS management I created two CNAME records

enter image description here

I used the DNS targets that I got from Heroku for each of the records. The wild card got the DNS target from example.com and the www got the DNS target from www.example.com.

Now, I wanted to test this setup so I tried to use GET request in Postman. I tried http://www.example.com and got 200 and the response I was expecting. However, when I tried http://example.com (without the www prefix) I didn't get any response but an error instead:

Error: write EPROTO 140275225778376:error:10000458:SSL routines:OPENSSL_internal:TLSV1_ALERT_UNRECOGNIZED_NAME:../../third_party/boringssl/src/ssl/tls_record.cc:594:SSL alert number 112

Is this setup that I mention is correct? If I want to support both of the domain with and without the www prefix what is the correct way to set this up?

1

1 Answer 1

0

You did not specify a DNS record for the bare domain (also called the "domain apex".) You can add a record for the domain apex either by leaving the subdomain field blank or by entering @ for the subdomain. I'm not sure which would work at Goaddy.

The problem is that you can't use a CNAME record for the domain apex. You can only use A records there. Heroku requires that you point to their servers by name rather than by IP address because they may change the IP address of your hosting at any time without notice. See The Limitations of DNS A-Records | Heroku Dev Center.

To point the naked domain to Heroku for hosting you need to use a DNS provider than supports entering a name in the apex, but serves it as an A record by IP address. This type of synthetic record is usually called an ALIAS or ANAME DNS record.

Unfortunately Godaddy does not offer ALIAS or ANAME records in their DNS hosting. You will need to either let Godaddy redirect the bare domain to www or find a new DNS host.

I would not recommend allowing Godaddy to redirect your bare domain to www. There are several problems:

You should instead choose a different DNS host that offers ANAME/ALIAS functionality and move your DNS hosting by changing the NS records at Godaddy to point to your new DNS host. See Godaddy's instructions for editing NS records

1
  • "You can only use A records there." Or AAAA ;-) As for CNAME at apex feature in a sane/standard way more and more DNS providers should support HTTPS DNS records (not to be confused with HTTPS the protocol) as browsers are on board to support it. That does not solve the problem right now for all clients though obviously. Mar 24, 2022 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.