locked
Redirect HTTP to HTTPS RRS feed

  • Question

  • User444756084 posted

    I have added the following code to the web.config to redirect HTTP requests to HTTPS. It works for me but not for another user. Any ideas??

     <rewrite>
          <rules>
            <rule name="HTTP to HTTPS redirect" stopProcessing="true">
              <match url="(.*)" />
              <conditions>
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
              </conditions>
              <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
            </rule>
          </rules>
          <outboundRules>
            <rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
              <match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" />
              <conditions>
                <add input="{HTTPS}" pattern="on" ignoreCase="true" />
              </conditions>
              <action type="Rewrite" value="max-age=31536000" />
            </rule>
          </outboundRules>
        < <rewrite>
          <rules>
            <rule name="HTTP to HTTPS redirect" stopProcessing="true">
              <match url="(.*)" />
              <conditions>
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
              </conditions>
              <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
            </rule>
          </rules>
          <outboundRules>
            <rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
              <match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" />
              <conditions>
                <add input="{HTTPS}" pattern="on" ignoreCase="true" />
              </conditions>
              <action type="Rewrite" value="max-age=31536000" />
            </rule>
          </outboundRules>
        </rewrite>
        <httpRedirect enabled="true" destination="https://portal.gustate.com/NSystem" />

    Wednesday, July 27, 2016 4:08 PM

Answers

  • User-718146471 posted

    </rule>

          </outboundRules>

          < <rewrite>

                   <rules>

                          <rule name="HTTP to HTTPS redirect" stopProcessing="true">

    See that extra < next to <rewrite>? Is that a typo? If not, remove that from your web.config and that should fix it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 27, 2016 8:45 PM
  • User-359936451 posted

    You need to set this up in IIS.

    https://support.microsoft.com/en-us/kb/324069

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 27, 2016 8:45 PM

All replies

  • User-718146471 posted

    </rule>

          </outboundRules>

          < <rewrite>

                   <rules>

                          <rule name="HTTP to HTTPS redirect" stopProcessing="true">

    See that extra < next to <rewrite>? Is that a typo? If not, remove that from your web.config and that should fix it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 27, 2016 8:45 PM
  • User-359936451 posted

    You need to set this up in IIS.

    https://support.microsoft.com/en-us/kb/324069

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 27, 2016 8:45 PM
  • User-718146471 posted

    You need to set this up in IIS.

    https://support.microsoft.com/en-us/kb/324069

    That would be my other recommendation :)

    Wednesday, July 27, 2016 8:46 PM