IIS accessing site without port

10,928

Solution 1

When you enter a URL without a port, port 80 is implied.

No browser that I know of has any way to change this behavior; if you want to use port 3333, then you'll need it in the URL.

Solution 2

You can use Reverse Proxy to silently redirect all HTTP requests to another port. Obviously, there still should be a site bound to TCP port 80 (that is the port which is used when no specific port is specified), which you will configure to make such redirect to another port.

It is possible with IIS 7 + URL Rewrite module + Application Request Routing (or IIS 7 + Helicon Ape if you prefer Apache-style configuration).

Question is -- if you can bind a site to port 80, why would you need to run it on port 3333 then?

Solution 3

When you assign an IIS site to a TCP port, the IIS process actually binds to the TCP port. This means that any connection (less filtering at the stack level, example: software firewall) incoming on that TCP port is serviced by this IIS site instance.

What you could do is:

  1. Create a CNAME for the FQDN you wish destined for the server for which the site is hosted (if it's on the same server, okay).
  2. Create an IIS site to bind to port 80.
  3. In the site properties, on the Web Site tab, next to IP address, click Advanced. Change the host header value to the FQDN.
  4. Then, in the site properties, on the Home Directory tab, redirect to the url: http://CNAME:[bound port]

For instance, a user hits: http://redmine

  1. CNAME for redmine is 192.168.10.101 (WEBSERVER2).
  2. Their browser then connects to 192.168.10.101:80 (this is the default TCP HTTP port, all browsers will hit this port unless specified otherwise).
  3. The IIS site serving out 192.168.10.101:80 has the rule to inspect the Host Header for the source NAME hit... matches, okay... perform redirection rule.
  4. Redirection rule redirects the user's browser to http://redmine:8080

All the user did was hit http://redmine

This obviously allows you to host multiple sites on a single box. "Virtual host" if you will.

Share:
10,928

Related videos on Youtube

Dhirendra Gautam
Author by

Dhirendra Gautam

Updated on September 18, 2022

Comments

  • Dhirendra Gautam
    Dhirendra Gautam over 1 year

    I have deployed our company intranet website to IIS 7 server added the following binding info.

    IP Address: All Unassigned port: 3333 domain name: subdomain_name.domain_name.com

    Although the site is deploy on port 3333, I want to be able to access site without port.

    I have added the entry in dns also. I can ping the fully qualified domain name (subdomain.domain.com) but when I add that url in the browser I get 404.

    When the site is deployed under port 80 it works just fine. However, it doesnt work when my site is hosted on anything other then the default port (80).

    Is there a way to do this?

    • jkdba
      jkdba over 3 years
      Worth adding this link about reverse proxy setup and url rewrite for IIS here
  • Admin
    Admin almost 2 years
    port is always required ? directoryactiveapi.MYDOMAIN.com:70100/swagger/index.html `not solution using firewall rules, reverse proxy or another?
  • Admin
    Admin almost 2 years
    Another port, is another IIS site. I have Default Web Site in 80, and REST API in port 70100 .port is always required ? directoryactiveapi.MYDOMAIN.com:70100/swagger/index.html `not solution using firewall rules, reverse proxy or another?