我有一个在IIS 8.5上托管的ASP.NET网站,我正在使用以下规则将所有流量重定向到HTTPS:
<rule name="HTTP/S to HTTPS Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{SERVER_PORT_SECURE}" pattern="^0$" />
</conditions>
<action type="Redirect" url="https://example.com{REQUEST_URI}" redirectType="Temporary" />
</rule>
当用户使用https://192.168.0.3
Your connection is not private
Attackers might be trying to steal your information from 192.168.0.3 (for example, passwords, messages, or credit cards). Learn more
NET::ERR_CERT_COMMON_NAME_INVALID
安装的SSL是用于域示例com.com的,似乎请求未达到IIS,因此我对此没有任何控制权。...?我无法控制用户迫使他们使用域URL。
如何将https:/192.168.0.3
重定向到https://example.com
?
试图SSL安全的本地IP URL总是会出现证书错误afaik
阅读此信息以了解更多信息:https://security.stackexchange.com/questions/103524/lets-cents-cents-cents-cents-cents-cent-for-intranet-websites
编辑:我对IIS不了解,但在此问题上找到了这一点,可能会帮助您解决此问题:https://blogs.msdn.microsoft.com/robert_mcmurray/2013/11/15/如何trust-the-iis-express-sign-signed-certificate/
给定HTTPS私有IP永远不会起作用(您无法获得有效的证书),我认为您已经在这里了,因为您已经从http://192.168.0.3
中进行了全局重定向到https://192.168.0.3
。只需修复重定向,以便从http://192.168.0.3
直接转到https://example.com
。
您可以做的是在IIS中创建另一个网站,然后将IP地址绑定到它。然后在该网站中创建一个带有重定向到正确域的单个Default.aspx
页面。
<%@ Page Language="C#" %>
<%
Response.Redirect("https://example.com");
%>
或仅带有URL重写的web.config
文件
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect" stopProcessing="true">
<match url="(.*)" />
<action type="Redirect" redirectType="Permanent" url="https://example.com" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>