IIS URL Rewrite https rule ignoring localhost

Your code should look like this instead

<rule name="Redirect to https" enabled="true" stopProcessing="true">
   <match url="(.*)" />
   <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
      <add input="{HTTPS}" pattern="off" />
      <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
   </conditions>
   <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>

Leave a Comment

tech