Are the hostname resolved by DNS and the hostname resolved by web server for virtual hosting independent of each other?

Are the following two independent of each other:

  • the hostname resolved by DNS and

  • the hostname resolved by web server for virtual hosting ?

Thanks.


Solution 1:

I think I know what you're asking here, and yes, it is.

  1. The DNS lookup to mywebsite.com is a function of your local machine. You type www.mywebsite.example, DNS resolves it to 192.0.2.4 and then:

  2. The browser makes a request to 192.0.2.4, and as part of that request it specifically asks for www.mywebsite.example. This is called the host header.

It's that host header which the web server uses to decide on which virtual host to display. Indeed, in the early days, it simply wasn't supported by all browsers and it has nothing to do with DNS.