IIS通过URL重写配置http跳转https,排除部分域名

作者: 来源:本站原创 点击数: 发布时间:2022年01月04日

设置http强制跳转https,请参考:

https://tech.powereasy.net/cpzsk/dynetbbcjwt/content_21000

但是IP访问需要不跳转,添加<add input="{HTTP_HOST}" pattern="^192.168.0.102$" negate="true" />即可

dfcaa6bfe5c74169972eb5ad8c40f165.png

<rewrite>
            <rules>
                <rule name="https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                        <add input="{HTTPS_HOST}" pattern="^(localhost)" negate="true" />
                        <add input="{HTTP_HOST}" pattern="^192.168.0.102$" negate="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
                </rule>
            </rules>
        </rewrite>