Alexander Kleinhans
Alexander Kleinhans

Reputation: 6258

Why does my browser resolve DNS differently from dig?

I have recently set up Heroku hosting with a domain name.

I am able to visit myappname.herokuapp.com.

When I type dig mydomain.com, I see the first record (which I pointed my CNAME to) is myappname.herokuapp.com.

When I go to whatismydns.net, I can see myappname.herokuapp.com is the CNAME for mydomain.com.

Why do I get something different from Heroku when I go to myappname.herokuapp.com versus mydomain.com? (specifically, mydomain.com shows "There's nothing here, yet.").

Upvotes: 0

Views: 1102

Answers (1)

Dusan Bajic
Dusan Bajic

Reputation: 10899

You may see something different from Heroku when you go to myappname.herokuapp.com versus mydomain.com, but that does not mean that your browser resolves differently from dig.

Since CNAME is configured, both myappname.herokuapp.com and mydomain.com will resolve to same ip address/server, but there is more to http request than ip address. That one remote heroku server hosts many websites (on a single ip address) and when it receives http request, it will use the value of "Host" http header to determine which website to serve (the value of that header is the hostname that you typed in your browser's address bar). .

My guess is that you did not add a custom domain to your heroku app, so heroku server just does not know what to do with it, so it is serving the default page.

Upvotes: 1

Related Questions