5

In IIS, I noticed when you use the default ports (80 for http and 443 for https) the port number doesn't display at the end of the URL in your browser. However, if you use a different port it will display.

Example: Default port generates link: http://www.example.com

Custom port generates link: http://www.example.com:8301

Is there a setting you can change to make the port (in this case, :8301) not display without using the defaults?

1
  • The port number is a significant part of the URL - it's not an optionally displayed item and not related to IIS. For non-standard ports, the number must be included.
    – adelphus
    Jun 5, 2015 at 18:34

1 Answer 1

9

80 is a default port for HTTP connections. http://example.com = http://example.com:80

443 is a default port for HTTPS connections. https://example.com = https://example.com:443

If you are hosting on an other port, you have to include it in the URL.
It's not a IIS rule - it's about HTTP in general. You cannot configure the server in such way that http://example.com will work with port 8301 and I can't imagine any situation when it can be useful. I strongly believe that 80 port is chosen by default on a browser-side but not assigned on a server-side.

If you want users to reach this website by http://example.com URL and it must be a main page then swap your 8301 and 80 ports WebSites' bindings.

3
  • 1
    a use in case is when a load balancer is on port 80 and the actual application is on a different port. There are url rewrite rules for switching the application, but i'm having trouble with internal hard-coded links (generated by the application) i need a rule to rewrite the port number. Dec 11, 2015 at 21:20
  • @Yeldar Kurmangaliyev Can I rewrite/redirect some sub domain name to specific port using url rewrite? Nov 6, 2017 at 5:02
  • @Kumaan: You will face issue If you use a proxy - which handle https and a server running apache for host the app and iis for reverting proxy
    – Nam Le
    Sep 13, 2019 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.