在URL重写中加入hid aspx ext后,IIS不安全。

问题描述 投票:0回答:1

我有一个windows server 2016 Standard.我安装了SSL,工作正常。我还在URL重写中添加了以下内容,将http重定向为https。

 <rules>
            <rule name="ssl redirect" enabled="true" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="^OFF$" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
            </rule>
        </rules>

现在我添加了一个规则来隐藏我的扩展。

<rule name="hide .aspx ext" enabled="true">
                <match url="^(.*)$" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    <add input="{REQUEST_FILENAME}.aspx" matchType="IsFile" />
                </conditions>
                <action type="Rewrite" url="{R:0}.aspx" />
            </rule>

然而,现在,我没有得到安全符号(锁图标)任何更多,并说该网站是不安全的.我做错了什么? 谢谢任何帮助

asp.net ssl iis-8
1个回答
1
投票

URL rewrite不应该报告这个错误,当你只是重写为友好的URL.你是否在Edge或chrome中收到这个错误?

1.我注意到你使用的是 MatchAny 根据我的理解,您应该使用 MatchAll 而不是。

     <rule name="hide .aspx ext" enabled="true">
        <match url="^(.*)$" />
        <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <add input="{REQUEST_FILENAME}.aspx" matchType="IsFile" />
        </conditions>
        <action type="Rewrite" url="{R:0}.aspx" />
    </rule>

2.当chrome报告网站不安全时,你收到了什么错误信息?你是否收到了类似NET::ERR_CERT_COMMON_NAME_INVALID的信息?请打开chrome F12开发者工具->Seucrity。你应该能找到根本原因。2.请确保你使用的是有效域名和SAN的有效证书。

3.请确保http绑定和https绑定是在不同的站点托管。4.要启用SSL,需要启用要求SSL。然后,SSL握手会破坏来自同一站点的http请求,所以你需要另一个站点来处理http请求。所以你需要另一个站点来处理http请求并进行重定向。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.