Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pointoing my Heroku Rails app to www and without www works only for an hour?

My Rails app works with Heroku and if I set my CNAME at my domain register Afrihost to www.domain and without the www it works fine for an hour. Then it kills the app without the www domain infront and I have to log in and change the dns again.

Afrihosts states, because of a certain law it can't point a cname to both with a www and without a www in-front. Is that true for all domain registers?

What alternatives are there as I want to point to both with and without the www in-front.

Thanks in advance.

Erin

like image 521
Erin Walker Avatar asked Jul 31 '12 10:07

Erin Walker


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.

Is adding custom domain to Heroku free?

You can add custom domains to any Heroku app. Adding domains does not incur extra charges. For security purposes, you must verify your Heroku account to add domains to apps.


2 Answers

I liked the fix I went with. I just added a url redirect from mywebsite.com to www.mywebsite.com. So on type you just choose 'Redirect' and leave the host part blank. Then type in the url of your website 'http://www.mywebsite.com/' in the 'Data' section. Worked for me.

like image 140
Blaine Hatab Avatar answered Sep 29 '22 11:09

Blaine Hatab


CNAMES cannot be used on naked domains (e.g. yourapp.com), only subdomains (e.g www.yourapp.com).

For the naked domains, you need an A record, or something like DNSimple's ALIAS.

like image 39
Neil Middleton Avatar answered Sep 29 '22 10:09

Neil Middleton