Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a non-www domain with heroku?

I know they don't support it, but seriously, how to do it? Point A-records to an ip which only serves up a 301 to heroku? That sounds really dumb. Am I missing something?

Is there a simpler workaround?

like image 396
dsp_099 Avatar asked Dec 23 '12 22:12

dsp_099


People also ask

How do I redirect a non www Heroku?

Go to the record editor and two DNS records, one for each host name, pointing to the Heroku SSL endpoint: Add an ALIAS record to point example.com to Heroku. Leave the Name of the record empty and set the Content field to the SSL endpoint example.com.herokudns.com. Add a CNAME record to point www.example.com to Heroku.

How do I connect my Heroku to my domain?

Summary of stepsAdd the custom domain to your app with the heroku domains:add command. Look up the Heroku-supplied DNS target for the custom domain using the heroku domains command. Configure your app's DNS provider to point to the Heroku-supplied DNS target. Confirm that your app is accessible via the custom domain.

Can you use a GoDaddy domain with Heroku?

GoDaddy does NOT Support Heroku.


2 Answers

There is a simpler workaround.

Point your www CNAME to myapp.herokuapp.com

Then forward your root url (myapp.com) to www.myapp.com

like image 166
darrendev Avatar answered Sep 27 '22 03:09

darrendev


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.

like image 20
howanghk Avatar answered Sep 27 '22 03:09

howanghk