Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a site where any traffic coming in on port 80 needs to be redirected to port 443 (https). According to this article, that is easy enough and it works. My problem is, however, that this is a load balanced environment. I want to open up a non standard port behind my firewall so that when my sever is off the load balancer I can push my code and test it using http://myip:XXXX via http on the non-standard port without it forcing https.

The rule used in the article is this

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
  <match url="(.*)" />
      <add input="{HTTPS}" pattern="off" ignoreCase="true" />
  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />

How can I tweak this so it only redirects for port 80 (or doesn't redirect for my test port)?

share|improve this question

The web.config file is site-centric (or rather, directory-centric, to the directory it's sitting in), regardless of which port you hit it on.

The trick (and I've never done this in regards to ports) is going to be to change your URL match rule to match URL requests that end in :80. My initial guess would be that changing it to (.*:80) might just work.

share|improve this answer

You must log in to answer this question.

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