How do CNAME and A records interact (in this weird case)

iwein asked:

I’ve managed to surprise myself with some DNS configuration. This is the actual output of my terminal:

[]$ host www.sepa-converter.nl
www.sepa-converter.nl is an alias for sepa-converter.herokuapp.com.
sepa-converter.herokuapp.com has address 184.73.167.111

[]$ host sepa-converter.herokuapp.com
sepa-converter.herokuapp.com has address 184.72.248.52

The result is that if you browse to www.sepa-converter.nl, you do not get the content served by sepa-converter.herokuapp.com.

I’ve used sepa-converter.nl as an alias for overopsepa.nl. And I want the mails to keep showing up at my Google Apps account. For that reason I’ve kept the A and MX records, but just changed the CNAMES to point to another server.

Why doesn’t this resolve www.sepa-converter.nl to the right heroku app?

UPDATE:
I understand that heroku doesn’t return the same IP each time and I understand that that’s not a problem. The problem is that the http requests serve content that is coming from a different dyno than the one aliased. If you check www.sepa-converter.nl against sepa-converter.herokuapp.com you’ll see a different index.html being served.

My answer:


Nothing is wrong with your DNS setup. You need to tell Heroku about the hostname you want to use.

heroku domains:add www.sepa-converter.nl

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.