Web.config rule for a site running behind load balancer so as to redirect from http to https
<rules> <rule name="HTTPS rewrite rule for site seeing load balancer" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions> <add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{SERVER_NAME}{URL}" /> </rule> <rule name="HTTPS rewrite rule for application seeing no load balancer" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> <add input="{HTTP_X_FORWARDED_PROTO}" pattern="^(.+)$" negate="true"/> </conditions> <action type="Redirect" redirectType="Found" url="https://{SERVER_NAME}{URL}" /> </rule> </rules>
Helpful Post