Assume my server ip address was : http://192.168.1.100 (NON SSL)
And my domain name was : https://helloserver.com (SSL)
If someone was to access my website via the domain helloserver.com
the server should automcatically redirect it to HTTPS.
I've managed to get that done by applying the below rule
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent"
url="https://{HTTP_HOST}/{R:1}" />
</rule>
But however if someone access the website from the IP Address itself, it'll give a certificate error because the ip address doesn't have a certificate.
How can i modify the below rule in away that when the IP Address is used to access the website it would use HTTP instead of the redirected HTTPS rule
I'm guessing it has something to do with <match url="" />
condition.
Any idea's?
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<add input="{HTTP_HOST}" pattern="^helloserver.com$" />
</conditions>
<action type="Redirect" redirectType="Permanent"
url="https://{HTTP_HOST}/{R:1}" />
</rule>