Configuration to redirect HTTP to HTTPS on Windows Server 2012 R2 IIS 8 hosting MVC C# app.

Change ELB target group health check path to  /healthcheck.html.

elb_healthcheck

Create basic HTML file named healthcheck.html and place in webroot.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Health Checktitle>
head>
<body>
    Hi
body>
html>

Add rewrite rule to web.config as last entry in system.webServer node.

<rewrite>
      <rules>
        <clear />
                <rule name="https redirect" stopProcessing="true">
		   <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" negate="true" />
                        <add input="{REMOTE_HOST}" pattern="localhost" negate="true" />
                        <add input="{REMOTE_HOST}" pattern="uat.specbyte.com" negate="true" />
                        <add input="{REMOTE_ADDR}" pattern="127.0.0.1" negate="true" />
                        <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
                        <add input="{HTTP_URL}" pattern="healthcheck.html" negate="true" />
                    conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
                rule>
      rules>
    rewrite>