I have to redirect a full URL from HTTP to HTTPS for an Angular app that needs to be hosted on an IIS server.
I created the following rules, but it is not working, it only works with the main domain (like http://www.somedomain.com, it redirects just fine, but but with http://www.somedomain.com/route
Here are my rules. What am I doing wrong?
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="./index.html" />
</rule>
</rules>
The idea is to redirect http://www.somedomain.com/route/something or http://somedomain.com/route/something to https://www.somedomain.com/route/something