Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add GoDaddy naked domain to Heroku app

Heroku custom domains

I've setup two custom domains for my Heroku app.

example.com        example.com.herokudns.com
*.example.com      wildcard.example.com.herokudns.com

Domain configuration

I configured my domain as follows:

  1. I added a CNAME Record for * pointing to wildcard.example.com.herokudns.com.
    Works fine.

  2. I forwarded my URL using GoDaddy's Domain Forwarding tool, because I can only specify IP addresses as A records.


Problem

The domain forwarding points to example.com.herokudns.com. Unfortunately GoDaddy automatically prepends http://, so it actually does not open my app and instead shows a Heroku message:

There's nothing here, yet.


Goal

Setting up my GoDaddy root domain to point to my Heroku app.


Note: GoDaddy automatically added an A record for @ pointing to >>++FWD1++<<

like image 790
heroxav Avatar asked Jan 03 '17 18:01

heroxav


People also ask

How do I add GoDaddy domain to Heroku app?

Navigate to the project folder from the terminal then type "heroku domains:add www.yourdomain.com". The domain name is the one purchased from GoDaddy. Next, log into your GoDaddy account and find the domains area in the upper left navigation tab. The domains tab will allow you to choose a domain then launch.

Can I use my own domain with Heroku?

You can buy a custom domain name with a domain registration service. Add the custom domain to your app with the heroku domains:add command. Look up the Heroku-supplied DNS target for the custom domain using the heroku domains command. Configure your app's DNS provider to point to the Heroku-supplied DNS target.


2 Answers

Cloudflare does the job!

Finally, I achieved my goal of using my naked domain as host by choosing CloudFlare to handle my DNS configuration.

Resources:

  • CloudFlare allows CNAME Records to be the naked domain
  • How CNAME Flattening works

Note: CloudFlare has a pretty good documentation and setup process, you just need to:

  1. add your domain to CloudFlare
  2. follow the CloudFlare setup guide
    • updating your nameservers (in my case GoDaddy) to point to CloudFlare
like image 123
heroxav Avatar answered Oct 16 '22 16:10

heroxav


What did you set your DNS to forward to? I had this same problem, but solved this creating a Heroku DNS entry for www.myapp.com. Heroku creates a DNS target of www.myapp.com.herokudns.com.

Here is my setup:

  • DNS forwarding to www.myapp.com
  • DNS CName of www to www.myapp.com.herokudns.com
  • Heroku DNS added www.myapp.com
like image 2
Mathew Kleppin Avatar answered Oct 16 '22 17:10

Mathew Kleppin