Point a root domain (non-subdomain) to heroku
For apps where you want the root domain (example.com) to be the app on heroku, and not a subdomain (like app.example.com), you'll need to use Cloudflare.
That's because with Heroku, you can't simply point an A Record to an IP address. Sub domains can easily point a CNAME to Heroku's address. But root domains cannot.
Godaddy doesn't offer a way to point a root domain using an Alias or CNAME.
So do this to point a root domain from Godaddy to Heroku via Cloudflare:
Log into Cloudflare (hi@briancasel.com)
Point the nameservers from Godaddy to point to Cloudflare
In Cloudflare, go to the DNS panel. Create a CNAME that points to Heroku's path. It should look like this: https://d.pr/i/bGIB7J
In the rails config > environments > production.rb > uncomment this line:
config.force_ssl = true
then push this change to heroku production.In Heroku, make sure the SSL option is enabled and not showing errors.
(at least for ZipMessage I had to do this) In the SSL panel in Cloudflare, set the setting to "Full" in order to avoid a redirect loop.
Last updated