I have an Azure web application and need help with enforcing https.
https://www.example.com to https://example.com
http://www.example.com to https://example.com
www.example.com to https://example.com
example.com to https://example.com
The current web.config is as below. This does not work for https://www.example.com -> https://example.com
<rules>
<!-- Force HTTPS for all requests -->
<rule name="HTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
<!-- Redirect all requests to non www-->
<rule name="WWW" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
</conditions>
<action type="Redirect" url="https://example.com{PATH_INFO}" />
</rule>
</rules>