locked
Sharepoint 2010 , IIS 7.5 and URL Rewrite redirect http:// to https:// RRS feed

  • Question

  • User1434868654 posted

    I have a Sharepoint 2010 web app on a machine that uses IIS 7.5. My web app path has an SSL certificate associated with it, and that part is working.
    What I want to do is have a automatic re-direct for the http: path to go to the https: path.
    I have followed the required IIS URL Rewrite set up as outlined on http://www.jppinto.com/2010/03/automatically-redirect-http-requests-to-https-on-iis7-using-url-rewrite-2-0/.
    However, when I go to the http:// path for my SSL site, I still get a default IIS page with an image that links to the http://www.iis.net/ site.
    I suspect this page is intercepting what would have been the 404 error before any of the web.config stuff can be implimented for the Rewrite redirect.

    Tuesday, February 1, 2011 7:00 PM

Answers

  • User1434868654 posted

    OK - I had the 443 port configured for the protected site in IIS, but I did not have the 80 port configured. That way, when I tried to go to the http site, there was nothing there to receive it and I got the iisstart.htm page. Once I added the port 80 to the web site binding for the protected site, the URL Rewrite rule had something to chew on and actually worked.

    I subsequently applied the URL Rewrite to a number of other new SSL sites (after adding the 80 port for their bindings as well) and all is well.

     Thanks!

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, February 4, 2011 1:29 PM

All replies

  • User-2064283741 posted

    If you get the default IIS page then likely it is going to the default web site and not a 404 page.

    But follow this guide from :

    http://blogs.iis.net/ruslany/archive/2009/04/08/10-url-rewriting-tips-and-tricks.aspx  

    4. Redirect to HTTPS


     

    When a site that requires SSL is accessed via non-secure HTTP
    connection, IIS responds with HTTP 403 (Unauthorized) status code. This
    may be fine if you always expect that your site visitors will be typing
    “https://…” in the browser’s address bar. But if you want your site to
    be easily discoverable and more user friendly, you probably would not
    want to return 403 response to visitors who came over unsecure HTTP
    connection. Instead you would want to redirect them to the secure
    equivalent of the URL they have requested. A typical example is this
    URL: http://www.paypal.com. If you follow it you will see that browser gets redirected to https://www.paypal.com.


     

    With URL Rewrite Module you can perform this kind of redirection by using the following rule:


     

    <rule name="Redirect to HTTPS" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTPS}" pattern="^OFF$" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
    </rule>
    


     

    Note that for this rule to work within the same web site you will
    need to disable “Require SSL” checkbox for the web site. If you do not
    want to do that, then you can create two web sites in IIS – one with
    http binding and another with https binding – and then add this rule to
    the web.config file of the site with http binding.

    ++++++++++

    If you still have problems then use the failed request tracing and follow through what is happening.

    Tuesday, February 1, 2011 7:51 PM
  • User1434868654 posted

    OK - I had the 443 port configured for the protected site in IIS, but I did not have the 80 port configured. That way, when I tried to go to the http site, there was nothing there to receive it and I got the iisstart.htm page. Once I added the port 80 to the web site binding for the protected site, the URL Rewrite rule had something to chew on and actually worked.

    I subsequently applied the URL Rewrite to a number of other new SSL sites (after adding the 80 port for their bindings as well) and all is well.

     Thanks!

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, February 4, 2011 1:29 PM