How to use a non-www domain with heroku?
According to Heroku's documentation:
Zone apex domains (aka “naked” domains or “bare” domains), for example
example.com
, are not officially supported on Heroku apps, because DNS forbids CNAME records on the zone apex. However, some DNS hosts provide a way to get CNAME-like functionality at the zone apex.For each provider, the setup is similar: point the ALIAS or ANAME entry for your apex domain to myapp.herokuapp.com, just as you would with a CNAME record.
Heroku's documentation mentioned these providers with "CNAME" support for zone apex:
- ANAME at DNS Made Easy
- ALIAS at DNSimple
Besides, these providers also work:
- CloudFlare
- {A}Record
And most DNS providers (such as ClouDNS and Namecheap FreeDNS) have free webhop / web redirect, so you don't need to setup your own web server for the redirect.
There is a simpler workaround.
Point your www CNAME to myapp.herokuapp.com
Then forward your root url (myapp.com) to www.myapp.com