Loading ...

Web.config rule for a site running behind load balancer so as to redirect from http to https | CodeAsp.Net

Web.config rule for a site running behind load balancer so as to redirect from http to https

 /5
0 (0votes)

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>

Comments (1)

   
jackramon

Helpful Post

9/26/2016
 · 
by

Top Posts