Pointing the root domain to Heroku - heroku

I have an app on Heroku, but I can't get the naked root domain to work.
I have a CNAME record for www.mydomain.com pointing to my app.herokuapp.com
I can't create a CNAME for mydomain.com, domain provider tells me I need to do it through an A record, that points to my IP address.
So, since Heroku won't give me that IP address, how can I proceed?
Thanks

DNS RFC (RFC1033) requires the "zone apex" (sometimes called the "root domain" or "naked domain") to be an "A Record," not a CNAME.
CloudFlare provides a feature called CNAME Flattening which essentially solves this problem for you.
Read more: https://blog.cloudflare.com/zone-apex-naked-domain-root-domain-cname-supp/

Related

Adding a CNAME record in Cloudflare pointing to a Heroku hosted application

I have a NodeJS application hosted on Heroku and I'm using Cloudflare to handle my DNS settings.
Unfortunately, the root domain for my application won't resolve since I don't have CNAME record pointing to it and correspondingly, I also receive the following error on my Cloudflare dashboard:
"An A, AAAA or CNAME record was not found pointing to the root domain. The XXXX.com domain will not resolve".
I found the relevant documentation for Heroku-hosted apps (shown below) which explains that all I need to do is to add a CNAME record for my root and point it to the server name. (It also states why I can't point it to a static IP address)
My problem is - how do I add a CNAME record pointing to the server name when the field I'm supposed to add the server name to only accepts an IP address?
See below screenshots.
Additionally, I'm further confused by the following piece of documentation:
Turns out this is a browser issue with Cloudflare.
On Firefox this is what the CNAME input fields look like.
On Chrome this is what the CNAME input fields look like.

pointing Hostgator domain to Zerigo/DNsimple ALIAS

After reading about how a my-app.herokuapp.com cannot be referenced by an A Record by the simple fact that Heroku has a dynamic implementation of its servers, I chanced upon articles which extolled the uses of ALIAS functions in DNS services like Zerigo and DNsimple as a workaround for this issue.
This SO Post explains this problem has been solved, Point top level domain to heroku app
However I do not follow how exactly to implement the solution.
Assuming I have a functional ALIAS setup in Zerigo which points to my my-app.herokuapp.com how do I then have my current webhost point to this ALIAS for the root domain?
Here is my Hostgator Control Panel which shows how the root domain (fls.net) is directed to a particular server via an A Record. I would like to subistute that A Record with my Zerigo ALIAS. How do I do that? Do I change my A Record to a CName? and then just put the ALIAS name in?
Note:
This post: How to redirect a root (naked) domain to www - heroku and zerigo seemed to have the same issue, except I don't understand why he calls the solution of using an ALIAS as "temporary". Why would it be a temporary solution?
You have to change your domain's name servers to point to Zerigo's name servers. You do this through your HostGator config. Zerigo has an article on the name servers that your domain should use. This article from HostGator explains how to change your domain's name servers. Basically, you want to log in to the HostGator portal and change the name server's to the one's listed in Zerigo's article.
Zerigo can handle the DNS for your domains, but only if DNS resolvers know to look at Zerigo instead of HostGator. Right now, when a DNS resolver (such as the one used by your computer's operating system) looks up the IP address to which yourdomain.com resolves, it first looks for the name servers that handle yourdomain.com, and then queries them. If the name servers point to HostGator, it doesn't matter what records you put in Zerigo, because HostGator will be queried for the domain's associated IP address. If you want Zerigo to handle the DNS resolution, you have to point the name servers to those managed by Zerigo instead.

Custom domain name with Heroku

I've registered a custom domain name but am getting confused with how to point it to my app on Heroku. If I understand correctly, I need to update my CNAME Records where I registered my domain name.
I've pointed my CNAME to my app on heroku. However it appears I also need to update the A-Record and enter the IP address of my Heroku app... This is where I'm stuck, as Heroku does not seem to provide any IP Addresses.
What am I doing wrong?
You can point any host name at heroku, like www.yourdomain.com by adding a CNAME record:
CNAME www.yourdomain.com your-heroku-app.herokuapp.com
This will forward any DNS queries for www.yourdomain.com to resolve to the IP for your-heroku-app.herokuapp.com.

Custom root domain on Heroku

I have a domain, example.com, that I want to use for my rails-app that resides at example.herokuapp.com and I'm pretty confused how to go about to do this.
Heroku says
"Zone apex domains (aka "naked", "bare" or "root" domains), e.g.,
example.com, using conventional DNS A-records are not supported on
Heroku." And then they go on explaining workarounds (using ALIAS or
ANAME).
I have spent a good hour reading up on the subject (here on SO and elsewhere) but still don't get my head around this.
Are there any alternative ways or explanations on how to acomplish this for "a dummy"?
I'll take a stab at this as it's a frequent question.
Ok, so assuming you have a domain example.com and you want to use www.example.com to host your site. In traditional hosting you'd probably have a virtual server which has been assigned an IP address, in this case you would use a host record, otherwise known as an A record in DNS control panels to map www.example.com to the IP address. In this case, since you have now set www.example.com to a fixed IP address should that IP address ever change you will need to update your DNS yourself.
Also, with traditional hosting you could have example.com set to the same IP address so www.example.com and example.com would work for naked domains.
Ok, so what's a CNAME record. A CNAME record rather than mapping to an IP address maps the record to another DNS entry. So, www.example CNAME'd to example.herokuapp.com means that Heroku can and may move where example.herokuapp.com is pointing at but you don't have to update anything as you're using an CNAME record and Heroku are managing where example.herokuapp.com is pointing (which can and may be another CNAME or an IP address). The problem with CNAME records is that they CANNOT point to an IP address, which is fine for www.example.com but a problem with example.com. Heroku previously published IP addresses to be used for naked domains but problems ensued when they suffered DDOS attacks and couldn't replace those IPs with new ones as they were published IP addresses. For the new EU region, Heroku ARE NOT publishing IP addresses for use with naked domains.
What several DNS providers (DNSsimple I know is one) have done is add their own ALIAS records to their DNS servers to allow you to use CNAME's with naked domains so both www.example.com and example.com will work as now supported by Heroku. If you DNS provider does not support ALIAS records then it's worth moving the domain to a DNS provider that does support it. DNSsimple also supports redirect records so you can have www.example.com redirect to example.com at the DNS provider level and not at your application layer.
Found this:
http://blog.cloudflare.com/zone-apex-naked-domain-root-domain-cname-supp
CloudFlare provides a whole bunch of other benefits as well. I've been using them for all of my Heroku apps and I'm quite pleased to be honest.
They provide a lot value for free from my experience with them thus far.
If you look at DNS records specification you'll find no such record as ANAME.
The best way to solve this problem is:
Make CNAME entry for www subdomain to your heroku app, and CNAME record for root domain to www subdomain.
www.domain.com. 3600 IN CNAME app.herokuapp.com.
# 3600 IN CNAME www.domain.com.
P.S. It works, and do not make you waste money for mystic DNS records

How do you set up a custom domain with CNAME on Heroku without messing up email service?

I have a Rails app uploaded to Heroku and I'd like to use it for a custom domain name. I also have email for this domain name on 1and1 where I registered it and it's been in use and needs to remain working. I tried following this tutorial but it recommends using naked domains which Heroku is strongly discouraging. If I shouldn't use naked domains (is that better?), how do I use CNAME instead while still keeping the email functional?
You will need to add a CNAME record for each "hostname" you want to use. For example, if you want to use www.yourdomain.com you would need to add a CNAME record to your DNS server(service) that maps www -> your-app-name.heroku.com.
Your DNS servers will then direct all requests for www.yourdomain.com to DNS name you-app-name.heroku.com and Heroku's DNS handles the mapping to IP address.

Resources