Angular Web.config将规则http重写为https和角度路由组合

Angular Web.config将规则http重写为https和角度路由组合,angular,iis,Angular,Iis,对于角度应用程序,我在IIS中有以下重写规则: <rewrite> <rules> <rule name="Angular Routes1" enabled="true" stopProcessing="true"> <match url=".*" /> <conditions logical

对于角度应用程序,我在IIS中有以下重写规则:

<rewrite>
    <rules>
        <rule name="Angular Routes1" enabled="true" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.html" />
        </rule>
        <rule name="HTTPS Redirect" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTPS}" pattern="^OFF$" />
            </conditions>
            <action type="Redirect" url="https://www.example.com{REQUEST_URI}" appendQueryString="false" />
        </rule>
    </rules>
</rewrite>

,它被重定向到,但当我使用设置网站的路由时,例如:

它不是重定向到

我想知道我在添加两条规则时是否犯了错误,应该将所有规则添加到一条规则中


谢谢。

您可以先设置http到https规则,然后重试。如果仍然不起作用,您可以使用失败的请求跟踪来查看详细的错误原因