I recently added SSL functionality to my Rails app running on Heroku. I successfully purchased and created a certificate for my domain and using a CNAME in GoDaddy, the WWW subdomain of my app works correctly when a user browses to http://www.myappname.com
The page loads without any warnings and the certificate works as is supposed to.
The CNAME looks something like this:
host: www
points to: myappnamefoobar-1234.herokussl.com
However when I simply go to the “naked” domain name – myappname.com, a certificate error comes up.
How do I configure the DNS settings in GoDaddy to make this work?
https://devcenter.heroku.com/articles/avoiding-naked-domains-dns-arecords
There is a whole article in Heroku’s docs about naked domains but I don’t see how this would apply to GoDaddy’s DNS manager.
I know that Heroku has some sort of IP based SSL that is paid but is there another way to accomplish this?
The trick is to use rack-rewrite:
https://github.com/jtrupiano/rack-rewrite
It allows Rails to do a redirect from mydomainname.com to http://www.mydomainname.com since Heroku doesn’t allow naked domains.
You then use your DNS manager to point http://www.mydomain.com to Heroku’s SSL endpoint (paid, $20 per month).