Microsoft IIS: How to Forward from HTTP to HTTPS

1. Apply the URL Rewrite module as required:
– https://www.iis.net/downloads/microsoft/url-rewrite
– Extract and install it

2. Run InetMgr.exe > select the target website > double-click on Url Rewrite > click “Add Rule(s)” from the right-side menu > high-light “Blank rule” > OK > give this rule a name (e.g. crm.kimconnect.com HTTP to HTTPs) > Set the Inbound Rule as follows:
– Requested URL = Matches the Pattern
– Using = Regular Expressions
– Pattern = (.*)
– Ignore Case = checked

At Conditions window > set Logical grouping = Match All > click Add
— Condition Input = {HTTPS}
— Check if input string = Matches the Pattern
— Pattern = ^OFF$
— Ignore case = checked

At Action window > make these settings > click Apply when done
– Action type = Redirect
– Action Properties
— Redirect URL = https://{HTTP_HOST}{REQUEST_URI} OR https://{HTTP_HOST}/{R:1}
— Append query string = checked
— Redirect type = Permanent (301)

Double-click SSL Setting > ensure Require SSL is not checked

Right-click the website > Explore > locate web.config (if exists) > ensure that the following content exists within that file

    <system.webServer>
<modules>
<add name="WebApiUrlRewriteModule" type="Microsoft.Crm.Application.Components.Modules.WebApiUrlRewriteModule, Microsoft.Crm.Application.Components.Application, Version=8.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx" preCondition="managedHandler" />
</modules>
</system.webServer>

If the WebApiUrlRewriteModule is not defined, add this <rewrite> rule:

<configuration>
<system.webServer>
<!-- Added by KimConnect 8/15/19
URL Rewrite to enforce HTTP forwarding to HTTPS
-->
<rewrite>
<rules>
<rule name="HTTPS force" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
<!-- Added by KimConnect 8/15/19
URL Rewrite to enforce HTTP forwarding to HTTPS
-->
</system.webServer>
</configuration>

Perform IISreset > verify that http://crm.kimconnect.com automatically forwards to https://crm.kimconnect.com; otherwise, reverse the changes and call Mr Google.

Leave a Reply

Your email address will not be published. Required fields are marked *