首页 > 解决方案 > URL 重写无效证书

问题描述

因此,我们在 IIS 10.0 上运行,并且在我们的 ISP 注册了多个域,这些域都指向我们网络服务器的公共 IP。网络服务器只有一个分配给通配符子域的证书。所以#.rootdomain.nl

我已经设置了一个 URL 重写,将所有不同的域重写到我们的根域:https ://www.rootdomain.nl但是我遇到的问题是第一个重定向正常,但第二个没有重定向浏览器说这个域没有有效的证书。

网址配置:

<rule name="Redirects to www.domain.com" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
    <match url=".*" />
    <conditions logicalGrouping="MatchAny">
        <add input="{HTTP_HOST}" pattern="^(www.)?rootdomain.(com|be|de)$" />
    </conditions>
    <action type="Redirect" url="https://www.rootdomain.nl/{R:0}" redirectType="Permanent" />
</rule>

我试图实现的目标:.com 到 .nl www.rootdomain.com -->> 重定向 -->> www.rootdomain.nl rootdomain.com -->> 重定向 -->> www.rootdomain.nl

.de 到 .nl www.rootdomain.de-->> 重定向-->> www.rootdomain.nl rootdomain.de-->> 重定向-->> www.rootdomain.nl

.be 到 .nl www.rootdomain.be-->> 重定向-->> www.rootdomain.nl rootdomain.be-->> 重定向-->> www.rootdomain.nl

当然,所有 http 流量都必须重定向到 HTTPS,这是第二条规则:

<rule name="Redirect to HTTPS" enabled="false" patternSyntax="Wildcard" stopProcessing="true">
    <match url="*" />
    <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
        <add input="{HTTPS}" pattern="OFF" />
    </conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />

这就是我所经历的:

www.rootdomain.com -->> 无效的证书(点击继续) -->> 重定向 -->> https://www.rootdomain.nl rootdomain.com -->> 无效的证书(点击继续) -- >> 重定向 -->> https://www.rootdomain.nl

标签: redirecturl-rewritingiis-10

解决方案


我们必须确保 HTTPS 站点绑定配置了有效的证书。服务器拥有的每个域名都与证书的主题相对应,否则,当我们访问浏览器时,浏览器会提示与无效证书有关的错误。
为了将多个证书绑定到每个域名的同一个端口,我们需要勾选以下选项。 结果。 最后,我们可以根据需要应用 URL 规则。
在此处输入图像描述

在此处输入图像描述

<system.webServer>
       <rewrite>
        <rules>
          <rule name="MyRule" enabled="true" stopProcessing="true">
            <match url="(.*)" ignoreCase="false" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                <add input="{http_host}" pattern="www.bing2.com" />
            </conditions>
            <action type="Redirect" url="https://www.bing.com" redirectType="Permanent" />
          </rule>
        </rules>
      </rewrite>
</system.webServer>

如果有什么我可以帮忙的,请随时告诉我。


推荐阅读