IIS – Force SSL

I need this to be available at all times since a long time will fly by until I need this config again. If you don’t have a rewrite block then just create a dummy one in IIS. It goes without saying you need to have Rewrite module installed on IIS. Hint: Server Manager.

     <clear />
     <rule name="Redirect all requests to https" stopProcessing="true">
       <match url="(.*)" />
         <conditions logicalGrouping="MatchAll">
           <add input="{HTTPS}" pattern="off" ignoreCase="true" />
            type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" 
            redirectType="Permanent" appendQueryString="false" />

This solutions comes from Stack Overflow, like so many other good things: https://stackoverflow.com/a/41582149