1
votes

I'm trying to use the URL Rewrite module for IIS 7.5 to redirect all HTTP requests to HTTPS for my ASP.NET website. The site works fine at the moment but forces the user to type the https:// in the address bar.

I followed the instructions in this article. Everything seems to be fine: I've tried putting the rule in the web.config and it shows up in the UI as it should; I've also done the reverse and can see the changes in the web.config when I use the UI to add the rule. I have RequireSSL unchecked for the site. Unfortunately I still just get a 404 when I try to hit the site via http://.

I've tried a few different action urls including {HTTP_HOST}/{R:1} and the one shown below.. nothing works.

<system.webServer>
  <rewrite>
    <rules>
      <rule name="Redirect to https" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}"
         redirectType="SeeOther" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>

I'm fairly new to this and pretty frustrated at this point. Seems like this should be a lot easier. Any advice would be appreciated, thanks..

Reposting from ServerFault as it's been sitting unanswered for a while.

1
The rule itself is absolutely fine -- works here. Has to be something else. What 404 Error do you get (turn ON displaying Detailed error message) exactly?LazyOne
I can't get it to display anything more detailed than "HTTP Error 404. The requested resource is not found". I have customErrors="RemoteOnly" and debug="true". Try to hit it at localhost via http and I get the same message. I can't use roles as it's the login page that I can't get to.Sleette

1 Answers

4
votes

HTTP Error 404. The requested resource is not found

Do you actually have binding for HTTP 80 port? Sounds like you do not have it (only HTTPS).

The reason I'm asking is the quoted text is the exact message that I would see if I request unknown to IIS domain (when there is no catch-all defined) or domain is not bound to the requested port.