Domain – Heroku Application Error on naked domain

cname-recorddomaindomain-name-systemheroku

I followed some advices to point a domain to a Heroku app.
The posts I'm talking about can be found here and here.
From the command line I added the custom domains to my app

$ heroku domains:add www.myapp.com
$ heroku domains:add myapp.com

and then I added these configuration in my Gandi Zones

@ 300 IN A 174.129.212.2
@ 300 IN A 75.101.145.87
@ 300 IN A 75.101.163.44
imap 300 IN CNAME access.mail.gandi.net.
pop 300 IN CNAME access.mail.gandi.net.
smtp 300 IN CNAME relay.mail.gandi.net.
webmail 300 IN CNAME agent.mail.gandi.net.
www 300 IN CNAME myapp.herokuapp.com.
@ 300 IN MX 50 fb.mail.gandi.net.
@ 300 IN MX 10 spool.mail.gandi.net.

Everything works fine on http://www.myapp.com, but on the naked domain http://myapp.com I get an Application Error from Heroku.

How to solve this problem?

Best Answer

If your DNS provider allows, you should alias the naked domain ('@') with a CNAME to your app.

@ 300 IN CNAME myname.herokuapp.com.

Cloudflare allows this, but not all DNS providers do as it's apparently out-of-spec. Heroku relies on it. Using the Heroku IPs as A-records is deprecated and can cause issues.

Related Topic