Using your GoDaddy Domain Name with Heroku
Two straight-forward DNS solutions to using your naked GoDaddy domain name with your Heroku application.
By Aaron Rohrbacher
While it may seem that GoDaddy's DNS system doesn't "play nicely" with Heroku applications, you actually can get a fully-nude domain name to work properly, even taking off its 'www!' I had a hard time accepting that I had to simply forward my naked domain name (aaronrohrbacher.com) to www.aaronrohrbacher.com, and the feeling ended up serving me well!
First, let's buzz over the widely-known method of forwarding the naked domain name to its 'www' CNAME record. Later on, I'll show you my full solution!
Let's head to the DNS editor:
• log in to your GoDaddy Account
• You should see a list of your owned domain names. On the domain name you wish to play with, click 'DNS.'
• You should see something like this:
• In the image above, this is a parked GoDaddy domain name, out of the box. Go ahead and delete all of these entries (don't be afraid!), by clicking on the pencil, followed by the trashcan, and confirming. Unfortunately, you'll have do do these one at a time. Of course, you won't be able to delete the NS entries, GoDaddy's nameservers will hang around for now!
While GoDaddy flips out for a minute or so, let's head to Heroku and get this domain name set up there.
you can easily add domains from the Heroku CLI, but for this blog, let's use the Heroku website.
• Log in to your Heroku account, and select your application.
• Click 'settings' on the navbar.
• About half-way down the page, you should see a section called 'Domains and Certificates.' Click 'Add Domain' on the right-hand side.
• Add 'yourdomain.com', and also add 'www.yourdomain.com'. Important that you add both!
• Your Heroku domains should now look like this (replacing aaronrohrbacher.com with whateveryourdomainis.com, of course!)
Now, back to GoDaddy.
• Once again, reach the DNS editor for the domain you're playing with (hit the refresh button if you've left the tab open). We should see this:
• Hit the 'ADD' button, and add a CNAME record:
• Select CNAME as a type.
• Under 'Host' enter 'www' (no quotes).
• Under 'Points to' enter 'www.yourdomain.com.herokudns.com' (no quotes).
• Click 'Save'
• Now, we have to forward the GoDaddy domain to the 'www' CNAME entry:
• At the bottom right of the page, you'll see a 'Forwarding' section. On Domain, click 'ADD.'
• Forward to 'www.yourdomain.com', forward type should be permanent, and settings should be 'forward only.' Click the checkbox to update your nameservers to support this change. the 'www' part of the domain must be there!
• Click 'Save'.
• Go brush your teeth or something... GoDaddy will need about 5 minutes to update the changes.
• Once you have nice fresh breath, hit the refresh button. You should see this:
Note: DNS changes can take up to 48 hours to propogate and be available. Avoid trying to visit your domain name during this process, as it can cause your ISP to take longer than normal. I find that most changes happen within about 15-60 minutes these days, but have definitely ended up in 'DNS hell' by checking back too soon/often. This might be a good time for a hike, or a nice movie.
Upon propagation (again, be patient!), you should be able to visit either 'yourdomain.com' or 'www.yourdomain.com' and see your magical Heroku application!
Cool, this works great, and works fine with search engines too. But... the www... my god, the www...
Weather you visit 'www.yourdomain.com' or 'yourdomain.com', the URL bar will show 'www.yourdomain.com'. Is it just me? I couldn't deal with it. Maybe it's because I'm out of my damned mind, but I wanted my naked domain to show up as such! Fortunately, Heroku has an add-on for that: PointDNS.
The only real advantage to using PointDNS is the fact that it allows ALIAS DNS records. The true solution to this problem of the 'www' is choosing a domain registrar that supports ALIAS or ANAME records. In this scenario, I didn't want the hassle (and expense) of moving my domain name from GoDaddy to a registrar that supports what I need. To Heroku, for supporting PointDNS: thank you!
Le's do it:
• Log in to Heroku, and select your application. Make sure your domains are added as above (both 'www.yourdomain.com' and 'yourdomain.com').
• Install the PointDNS add-on:
• In resources, under Add-ons, search for 'PointDNS'. Install it. For my purposes, the developer (free) version is great. It currently limits to 10,000 requests and 20 DNS records. Amazingly easy!
• Once installed, under 'resources,' click on 'PointDNS.' This will open its control panel. You should see your domain name in the list; click it!
• You should see a DNS record list, which will include NS entires. At the top, there is a 'Nameservers' tab, which will list available nameservers. Go ahead and update the 3 NS entries to the nameservers closest to you, and document them (yes, we'll need them in a moment). This will make the propagation process faster.
• Here's what mine looks like (I've blacked out some entries that don't apply here):
Head to GoDaddy.
Note: These steps will destroy all existing DNS entries. If you're doing this on an existing site or application, be sure that all is set up correctly on your PointDNS control panel beforehand!
• Log in, and visit your domain's DNS editor (see above).
• Under the 'Nameservers' section toward the bottom, click 'Change,' and adjust the dropdown menu from 'Default' to 'Custom.'
• Add the first two nameservers you chose above (I hope you remembered to document them!), then click 'Add Nameserver,' and add the third.
• Click 'save.' Once again, this will be a good time to make your bed, or cut your toenails. GoDaddy will need a few minutes to update.
• Once your life is together, refresh or revisit your DNS entries page on GoDaddy. It should now look something like this (your nameservers may vary from mine):
Now, all of your DNS records can be managed directly from your Heroku dashboard in the PointDNS addon, and your domain can be accessed without forwarding to that pesky 'www!' Note: Don't forget, your new DNS settings can take up to 48 hours to propogate. Avoid checking back to your site often if it's not working within about 30 minutes. No one likes DNS hell!
Ahh... I sleep so much better now!
Thanks for reading! I hope this was of some help... or not...; feel free to leave a comment either way!
Anonymous User said:
It helped a lot! Thank you.
Add a comment: