Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure DNS records for Name.com and a Heroku app

Tags:

heroku

dns

I'm a bit confused about how to set up the DNS records for my domain at Name.com so it can correctly point to my Heroku app.

I found DNS configuration documentation at heroku's site but I'm still confused.

I'm under the impression that I need to set up a CNAME record for all subdomains and an A record for my root domain.

Also, on the name.com website, when I try to add a CNAME there are three blank fields I need to fill out which kind of confuse me: "Host" (where I enter '*' so it applies to all subdomains?), "Answer" (where I enter the DNS Target?), and "TTL"

Any help would be greatly appreciated. Thank you.

like image 692
DC1477 Avatar asked Oct 07 '15 12:10

DC1477


People also ask

How do I get my CNAME from Heroku?

You can check the correct CNAME target for Heroku SSL (SNI) by running the Heroku CLI command: heroku domains -a your_app_name . You might have old Custom Domains that still display a your_app_name.herokuapp.com CNAME target. You should remove, and re-add these to ensure a herokudns.com CNAME is set up.

How do I link a Namecheap domain to Heroku?

First connect to the Heroku dashboard, select the heroku application and go to the "Settings" tab. Scroll down until you reach the Domain and certificates section. Click on the purple "Add domain" button and type the domain name with its subdomainyou want to use.

How do I find my Heroku name server?

Heroku doesn't provide DNS services therefore there are no name servers. You use your domain name registrars control panel to point your DNS records at your Heroku application. Typically this is a CNAME record pointing at the . herokuapp.com entry.

How do I point my Google domain to Heroku?

First open your app in the Heroku web page, then click the "Settings" button https://dashboard.heroku.com/apps/{your app name} Scroll down until you see the "Domains" section, Then click "Add domain" https://dashboard.heroku.com/apps/{your app name}/settings. Input the domain name you purchased from google (eg.


3 Answers

Don't use an A-record for your root domain. Heroku is using volatile IP addresses, which means the IP you configure in your A record can stop working at any moment without notice.
See https://devcenter.heroku.com/articles/apex-domains

On your root domain, you need to either setup an HTTP redirect to your www subdomain with your DNS provider, or use another provider which offers CNAME records for root domains.

As for the CNAME in your subdomains, yes, "Host" would be "*" to be all your subdomains.
Answer will be the endpoint provided by heroku, in the form appname.herokudns.com..
TTL means how often the DNS cache should be refreshed with the clients. Using the default (or 3600 if they don't provide any) will work here.

like image 87
Damien MATHIEU Avatar answered Nov 15 '22 12:11

Damien MATHIEU


Fully detailed steps (2)


1). Visit Heroku apps dashboard

  • Choose your app

  • Click "Settings"

  • Find text "Add Domain", click button

  • Add your site with www subdomain:

    • www.yoursitename.com
  • Copy the returned "DNS target" value


2). Visit your name.com account

  • Find link text "Manage DNS Records" and visit link

  • "ADD RECORD" row with the following content:

Type: Host: Answer:
CNAME www 📋 DNS target value from clipboard

(SAUMITRA KUMAR's answer, is what helped me write this answer.)

like image 23
Riveascore Avatar answered Nov 15 '22 10:11

Riveascore


Here's what worked for me. Start with typing this in the Heroku CLI

Heroku domains: add www.youwebsitename.com --app yourherokuapp 

This should give you a DNS target.You can obtain this from the your app settings as well on the website . Copy it and save it because we are going to need it later.Then after this run

heroku domains:wait for www.youwebsitename.com --app yourherokuapp 

Then visit name.com and under your domains visit your dns records . There add CNAME entry with HOST equal to "www.yourwebsite.com" and ANSWER equal to whatever the dns target that heroku supplied you with .

Go ahead and visit your website , it'll work , if it doesn't make sure that you've used www with your website name . To fix this issue add an ANAME entry with "yourwebsite.com" as HOST and heroku dns again as target . It should reflect the changes within few hours .

like image 38
SAUMITRA KUMAR Avatar answered Nov 15 '22 12:11

SAUMITRA KUMAR