IIS7, different ports for websites but no portnumber in the browser

5,239

Yes, but only if your environment includes a NAT firewall/router and multiple external IP addresses.

For http connections, the port number is optional on the browser only if the browser is connecting on port 80. Therefore, the browser would need to connect to port 80 in order for the port number to be optional in the URL.

Here is one possible scenario:

  1. You control the 101.101.101.0/20 subnet.
  2. website1.com: DNS "A" record points to 101.101.101.2
  3. website2.com: DNS "A" record points to 101.101.101.3
  4. Your IIS7 server has a local IP address of 192.168.0.67
  5. Firewall/router has a NAT rule redirecting 101.101.101.2:80 to 192.168.0.67:8080
  6. Firewall/router has a NAT rule redirecting 101.101.101.3:80 to 192.168.0.67:8081

With the firewall/router configured in this way, the browser clients would think they were connecting on the standard port 80, so no port number would need to be used in the external URL. However, the connections would be routed to ports 8080 and 8081, respectively, on your private network.

Is there a specific reason why you would like to use non-standard ports on the web server without requiring them to be entered as part of the URL?

Cheers,

Miles

Share:
5,239

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    I have a windows server 2008 with IIS7 with 4 websites. In DNS I have 4 different URLs which point to the IP of the server. I configured each web site with the site bindings:

    website1: hostname: url1, port: 80, IP-Adresse: the adress of the server

    website2: hostname: url2, port: 80, IP-Adresse: the adress of the server

    The result is, that from the client, I can browse with all the 4 URLs to the specified web sites and everything is fine.

    Then I changed in IIS the port of the websites, so that website1 now uses port 8080, website2 uses port 8081, and so on. Now I have to use the browser with the url and the portnumber (like URL:8080). Is there a possibility, to configured the websites with different portnumbers but not to use the portnumbers in the browser?

    • Dscoduc
      Dscoduc about 14 years
      Why did you find it necessary to add different ports for each of your websites when the host headers were working fine?
    • Admin
      Admin about 14 years
      Cause of security rules of our company, we should not use port 80.
  • Damien Sawyer
    Damien Sawyer about 14 years
    Virtual hosts is in IIS7 now called virtual directories, right? With this I still need at least one website with port 80 and this website then has several virtual directories. So I suppose there is no way to configure IIS7 (or the w2k8 server) that it listens on port 80 but redirect the clients request to another port like 8080.
  • JanOlMajti
    JanOlMajti about 14 years
    Thanks for your answer. Cause of security rules of our company, we should not use port 80. I just wanted to keep it simple for the users, so that they can type the url without the portnumber.
  • Cry Havok
    Cry Havok about 14 years
    I don't use IIS so can't say. You still haven't said why you want to use a non-standard port and don't want to use virtual hosts.
  • Damien Sawyer
    Damien Sawyer about 14 years
    Cause of security rules of our company for intranet applications, we should not use the standard port 80. I wanted to keep it simple for the users, but I suppose they have to write the portnumber to the url.
  • Cry Havok
    Cry Havok about 14 years
    Ah, security through obscurity - also known as none at all ;) You could configure your primary IIS server to perform the redirection, but anything you do to redirect users negates the pretend security using a non-default port provides.