2

I have created two test websites in IIS. one is called testapp.com and other is called anothertestapp.com.

enter image description here

In my host files both testapp.com and anothertestapp.com is pointing to 127.0.0.1

both apps are loading perfectly in browser and show their respective contents.

The question however is, how does IIS knows that testapp.com is different than anothertestapp.com. I mean when in browser I type two different domains they both actually are pointing to same IP (127.0.0.1), how does IIS map that to two different websites correctly?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
ahsant
  • 1,003
  • 4
  • 17
  • 25
  • Possible duplicate of [What is http host header?](https://stackoverflow.com/questions/43156023/what-is-http-host-header) – Uwe Keim Mar 14 '19 at 05:02
  • nope, this is not duplicate. This is a separate question, however that thread will explain "host headers" in more detail. – ahsant Mar 14 '19 at 05:12

1 Answers1

4

When your browser loads a web page, one of the request headers it sends is the text of the domain name you typed in. This is the "Host" request header. IIS uses the value of this header to pick which web site will serve your request. The "bindings" on your IIS web site let you configure its host headers.

Here's another question that explains the "Host" header in more detail: What is http host header?

David
  • 34,223
  • 3
  • 62
  • 80