iis 下http 自动跳转https

配置 iis rewrite :

  <system.webServer>
        <rewrite>
            <rules>
                <rule name="http2https" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTPS}" pattern="off" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
                </rule>
            </rules>
        </rewrite>
  </system.webServer>

 

已禁用评论。