4

I'm not 100% sure if this is the right part of StackOverflow to post this but to me it made the most sense. Sorry if its not!

Currently I have a site in IIS configured on HTTPS with port 7500. I can access this site by using the URL: https://portal.company.com:7500.

What I would like to do is remove the port number at the end of the URL so users can access this site using https://portal.company.com...

I am a complete beginner with IIS, but what I have tried is the HTTP Redirect, which if I used on this IIS site, would redirect a user that hits portal.company.com:7500 to some other site, which is not what I need. Another thing I have though about is creating another IIS site which serves the purpose of being at the URL portal.company.com and when its hit, it redirects to my portal.company.com:7500, but I don't know if this is the best approach.

So my question is, what are my options for achieving the behavior mentioned above and what is the best/recommended approach?

I haven't played with URL Rewriting before but I will look into that now while I wait for a reply. Thanks!!

Using IIS Manager on a Windows Server 2008 machine.

4 Answers 4

2

Try This

<configuration>
<system.webServer>
    <rewrite>
           <rules>
            <rule name="removePort" stopProcessing="true">
                <match url="^(http(s)?://)?(portal\.company\.com):7500(/.*)?$" />
                <action type="Redirect" url="https://{R:3}/{R:4}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

0

If as you note in a comment on the other answer you have another site already running on port 443, you will need another IP address so that you can bind the site to port :443 on that address, then change your DNS records accordingly. You cannot bind more than one site to the same socket with HTTPS in IIS, at least until SNI becomes totally viable and Microsoft updates the software accordingly.

The exception would be if you are running a wildcard or ASN certificate that is valid for both sites, then follow this procedure.

This is assuming your goal is to allow visitors to hit the site over HTTPS from their browsers without specifying a port. If I misunderstood your question then the answer won't be accurate:)

2
  • Thanks for the answer. Yes I am trying to have users access the portal.domain.com without any port number. Also I do have a wildcard certificate for *.domain.com so I will try running through the procedure you posted. Nov 22, 2013 at 16:49
  • I tried the procedure you mentioned and set both of my sites to port 443 and ran the command in cmd but it did not work, when I try to start my second site I get the port is already in use error message...any ideas Nov 22, 2013 at 18:44
-1

Have you tried simply changing the http binding to use port 80? That should be all you need to do, no need for redirection to take place. Assuming you don't have another web site on port 80, this should work just fine for you.

http://www.gadgetcage.com/how-to-change-iis-port-in-windows-7/3457/

This is based on the fact you were willing to create a new website on port 80 for the sake of simply redirecting to port 7500. Just take out the middle man and move you port 7500 site onto port 80, and problem solved.

6
  • Thanks for the answer. Well the site is actually HTTPS and I have another site running on port 443, and it looks like the default site is running on 444. Any other ideas? Nov 21, 2013 at 20:39
  • URL Rewrite can be used to redirect to a different port fairly easily, and would be the route I'd recommend here. The following tutorial is for exchange but it can be adapted to what you're doing. morgansimonsen.wordpress.com/2009/04/02/… Nov 21, 2013 at 22:34
  • Rewriting involves redirecting the user at the HTTP layer, it won't allow them to host two SSL sites on the same IP.
    – phoebus
    Nov 21, 2013 at 23:29
  • The is nothing stopping you from running two HTTPS sites on the same IP. See a Lync Frontend server, it setup that way by default. The same PORT, yes that wouldn't work. Your down vote is unwarranted. URL Rewrite can be used to redirect port 80 traffic over to port 7500, don't listen to phoebus. Just make sure your certificates are right. Nov 22, 2013 at 12:48
  • But it won't allow his users to visit the site directly via URL as the poster is requesting, without specifying the port, unless the site is bound on 443. Without that binding he will need to specify the port, unless you are suggesting that that binding he added and then the URL rewritten to correspond.
    – phoebus
    Nov 22, 2013 at 15:20
-2

you can use 2 ssl certs on the same server with one IP but they must use another port. Multi-name certs are quite costly. URL rewrite can be used to hide the port from the client.

2
  • That's not actually the case, with Server Name Indication (SNI) you can have multiple certificates on the same IP address and TCP port number.
    – HBruijn
    Feb 17, 2015 at 21:00
  • 2
    IIS7 doesn't support SNI
    – austinian
    Jul 20, 2015 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .