Petros Kyriakoupersonal blog

I am a full stack web developer. Love tinkering all the time, especially anything javascript related.

How to setup a GoDaddy Domain with Heroku

November 01, 2018

If you looked into attaching a GoDaddy domain with Heroku before, then you know that it is more than just a straight solution. The information is scarse and at best outdated.

After having to attach a GoDaddy Domain to Heroku for a client I will provide my findings here.

After you bought a domain the first to do is setup Heroku first.

Setup Heroku

Login to your Heroku account, choose the app you want to attach a domain name and then navigate to Settings

Find where it says Domains and Certificates and click Add Domain.

After Heroku finishes adding your domain you will receive a DNS Target like below

contoured-puma-gn2mra3lf3b87ijj3vmcg8na.herokudns.com

This is where we switch to the GoDaddy Interface

Setup GoDaddy

Login and find the domain name you purchased.

Make sure you are in the My Products Tab, find the domain name and click DNS

We need to add a CNAME record to point the domain name to the heroku DNS endpoint.

So click the ADD button, choose CNAME and add the info as shown below in the picture. Make sure to add your own herokudns.com URL and not the one I provided above.

GoDaddyCNAMERecord

After that is done, we need to add a redirect so that the naked domain (domain.com without the www part) or root domain as its called, redirects to the www version of it (www.domain.com).

DomainForwardingGoDaddy

NOTE: If you do not have an SSL certificate you need to use http:// from the dropdown.

SSL and Caveats

Now its time for the caveats between Heroku and GoDaddy. As per this article by Heroku, GoDaddy is not a fully compatible Domain Name Provider and they explain the reasons in the article if you would like to dive more into it.

In a few words, what the article says is, if the user accesses https://domain.com, Heroku won't be able to handle that because there is an issue with they type of records that GoDaddy lets you add.

Heroku needs CNAME-like records, called ALIAS or ANAME because they have dynamic IP addresses but GoDaddy and various other hosts do not provide them.

So even though we added a redirect (discard this if you don't have SSL), it won't work unless the user uses the http://domain.com variant.

Conclusion

Unfortunately, I wasn't able to find a way to make https://domain.com work. But if you come across a way that it works do let everybody know in the comments below.