Host Name in IIS Site Bindings. Purpose and Usage.

Ray Pooley 1 Reputation point
2023-06-30T10:08:25.97+00:00

Hi all

My understanding is that the Host Name can be used to match a site on IIS to a request

so that you don't have to specify the port address in the request url.

Examples:

WITHOUT Host Name in Bindings:

IIS Bindings : Type http Port 83 IP Address 192.168.1.225

Request URL mysite.mydomain,org:83 returns correct site on port 83.

Request URL mysite.mydomain,org returns default site on port 80.

WITH Host Name in Bindings:

IIS Bindings : Type http Port 83 IP Address 192.168.1.225 Host Name mysite.mydomain,org

Request URL mysite.mydomain,org:83 returns correct site on port 83.

Request URL mysite.mydomain,org returns default site on port 80. **

** In this case I am expecting IIS to use the Host Name specified in the Bindings to direct the

request to port 83. But this is not happening. The presence of the Host Name makes no difference.

Can anyone please explain how this is supposed to work?

What am I missing here?

Thanks

Ray

Internet Information Services
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,885 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Limitless Technology 44,096 Reputation points
    2023-06-30T14:57:42.5666667+00:00

    Hello there,

    In IIS (Internet Information Services), the Host Name in site bindings refers to the specific hostname that is associated with a website or web application running on the server. It allows you to host multiple websites on a single IP address by distinguishing them based on the hostname.

    Here's a breakdown of the purpose and usage of the Host Name in IIS site bindings:

    Hosting multiple websites: When you have multiple websites hosted on a single server with a shared IP address, the Host Name binding allows you to differentiate between these websites. Each website can have its own unique hostname (e.g., www.example1.com, www.example2.com), and IIS uses the hostname provided in the incoming request to direct the request to the appropriate website.

    Virtual hosting: The Host Name binding enables virtual hosting, where a single physical server can host multiple websites as if they were running on separate servers. This is achieved by utilizing the Host header in the HTTP request to determine the destination website.

    SSL/TLS certificate assignment: If you want to secure your websites with SSL/TLS certificates, the Host Name binding plays a crucial role. It allows you to assign a specific SSL/TLS certificate to each website based on the hostname. This ensures that the correct certificate is presented when clients access the website using its designated hostname.

    URL routing and redirection: By configuring different Host Name bindings, you can implement URL routing and redirection based on the hostname. For example, you can redirect requests from one hostname to another or route requests to different applications or folders within the same website based on the hostname.

    I used AI provided by ChatGPT to formulate part of this response. I have verified that the information is accurate before sharing it with you.

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer–

    1 person found this answer helpful.
    0 comments No comments

  2. MotoX80 32,716 Reputation points
    2023-06-30T13:11:45.8266667+00:00

    When a client browses http://somesite.com, the http part of that request says to use port 80. When a client browses https://somesite.com, the https part of that request says to use port 443.

    Lets say that you have 3 web sites that have different host header names and they are all configured for port 80. When the client request (http://somesite.com) comes in on port 80, IIS look to the url (somesite.com) to figure out which of the 3 sites to route the request to.

    Lets say that you have 3 web sites that have different host header names and they are all configured for port 83. When the client request (http://somesite.com) comes in it will fail becsuse the request (http) is for port 80, but all of your sites are listening on port 83.

    If the client overrides the default port and requests http://somesite.com:83 then IIS would look to somesite.com to figure out which of your port 83 sites to route the request to.

    http://it-notebook.org/iis/article/understanding_host_headers.htm


  3. Ray Pooley 1 Reputation point
    2023-07-01T07:06:34.9933333+00:00

    MotoX80

    I had a light bulb moment last night where the penny dropped so to speak.

    I re-read you comment about port 80 and changed the port on the 3 sites to port 80.

    And it worked. The requests are resolved using the host name without specifying the port in the url which is what I want.

    But this is only true when using port 80. That's the bit that doesn't make sense to me.

    Why can't it behave like this with any port?

    Anyway.

    Thanks for your help everyone.

    Much appreciated.

    Regards

    Ray


  4. TengFeiXie-MSFT 341 Reputation points
    2023-07-03T07:07:35.6133333+00:00

    Hi @Ray Pooley

    I probably see what you're thinking. If the hostname is bound, it can directly access without add port 83 on URL. The port number is only required if no hostname is bound. As community members discussed with you, this is not possible. Your idea is indeed elegant, but it doesn't fit with how IIS works.

    Only when using port 80 or 443, web browser knows the port for http or https and is automatically adding the port number 80 or 443 to the request to the server. Every connection on the internet needs an IP address and a port. You can host multiple websites on port 80 to avoid displaying the port number in the URL.

    Of course, you can redirect to the website on port 83 by adding URL redirect, and it can also achieve the effect you mentioned.

    Best Regard,

    TengFei Xie


    If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.