The Internet
The Internet

Reputation: 8103

heroku and domain name conventions

(tried on Server fault, so going to try here)

Hi I recently setup my octopress blog at http://davidmjohnson.me. This domain works fine, but when I try http://www.davidmjohnson.me I get a "heroku no app found." Why is the www not working. Would really appreciate an explanation. I bought my domain name at dnsimple. Do I need to add a redirect from "http://www.dav..." to just "http://dav..." ?

Thanks

Upvotes: 1

Views: 1120

Answers (2)

tutuDajuju
tutuDajuju

Reputation: 10840

I'm guessing you need to configure this domain (and any subdomain) in the heroku CLI application (equiv. of ssh-ing into the machine and changing the nginx/apache location/virtualhost configuration).

I see they have an entry about this in their reference: https://devcenter.heroku.com/articles/custom-domains

To elaborate a bit from the documentation:

Subdomains ( www.mydomain.com)

For each subdomain you want to setup configure your DNS provider using a CNAME record pointing the subdomain to the applicable Heroku hostname.

If the app is on Cedar, then CNAME the subdomain to myapp.herokuapp.com If Bamboo, then myapp.heroku.com

In DNSimple a CNAME record entry for a Cedar app would look like: enter image description here

You can confirm that your DNS is configured correctly with the host command: $ host www.example.com

www.example.com is an alias for myapp.herokuapp.com.

myapp.herokuapp.com is an alias for ar.herokuapp.com.

ar.herokuapp.com is an alias for argon-stack-1879049447.us-east-1.elb.amazonaws.com.

argon-stack-1879049447.us-east-1.elb.amazonaws.com has address 107.20.157.144

...

Upvotes: 1

redhotvengeance
redhotvengeance

Reputation: 27866

Actually, it should really be the other way around. It is much better practice to point CNAMEs at Heroku apps, since Heroku apps have no real "static" IP. Since naked domains need an A-record, pointing a naked domain to a Heroku app makes everything much less stable. So the best practice is to forward your naked domain to a "www" subdomain, and then point the "www" CNAME to your Heroku app.

Heroku goes into detail about this here.

Upvotes: 0

Related Questions