I have set up ssl on www.mydomain.tech in Azure. (mydomain.tech is a sample url not my actual domain). When I enter the url www.mydomain.tech I don't get any errors because SSL is working fine. When I go to mydomain.tech directly I get DLG_FLAGS_SEC_CERT_CN_INVALID error. I need to transfer any request which comes to mydomain.tech to www.mydomain.tech I am using the below code in Web.Config file to transfer. It is not working. Is my Url Pattern wrong or do I need to make any other change in azure to reflect my Web.Config changes? Please suggest. PS - I have restarted Azure machine after applying the change in Web.config.
<rule name="Redirect mydomain.com to www.mydomain.com" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*"></match>
<conditions>
<add input="{HTTP_HOST}" pattern="^mydomain.tech$"></add>
<add input="{HTTPS}" pattern="off"></add>
</conditions>
<action type="Redirect" url="https://www.mydomain.tech/{R:0}" redirectType="Permanent" appendQueryString="true"></action>
</rule>
I had to create a separate pfx file for both the domains using a free SSL provider(SSL for free) and had to add bindings for both the domains to make it work. Also had to enforce azure to use HTTPS only. This worked for me.