http-redirectherokucnamea-records

Heroku/GoDaddy: send naked domain to www


I am trying to figure out how to get the naked domain for my website to redirect to the www domain. I am using Heroku and have the domain from GoDaddy. Because of Heroku, my A records are already set up as:

@: 75.101.145.87

@: 75.101.163.44

@: 174.129.25.170

And my www CNAME points to proxy.heroku.com.

I've been looking all over the internet, but can't find a simple, free answer for how I can do this redirect. Some answers discuss using paid services, which I don't want to do, and others talk about going in and modifying Heroku settings, but then don't really give much explanation. Right now, if you go to my naked domain, it's just Heroku saying that no such app exists, while if you go to my www domain it's my app.


Solution

  • On GoDaddy, use the "Forwarding" feature to setup a forward from yourdomain.example to www.yourdomain.example. The forwarding feature can be accessed in the Domain Manager at the bottom of the "Domain Information" section:

    Domain forwarding in GoDaddy

    If you do this then all traffic to yourdomain.example will be routed to the Heroku app CNAME (which is the better approach).

    One note, however, if you are on the Cedar stack then don't use proxy.heroku.com for the host of your www CNAME. Instead use your-app-name.herokuapp.com. These details are covered here.

    GoDaddy also specifies that in order for your domain name to forward, its A record must be pointed to 64.202.189.170 or must fall between the following ranges: 50.63.202.1 - 50.63.202.31 or 184.168.221.1 - 184.168.221.31.