【发布时间】:2019-07-21 23:56:13
【问题描述】:
我有一个托管在 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 是针对域 example.com 的,而且请求似乎没有到达 IIS,所以我无法控制它....?我无法控制用户强制他们使用域 url。
如何将https:/192.168.0.3 重定向到https://example.com?
【问题讨论】:
-
你需要一个条件来检查
{HTTP HOST}。 -
您能否建议如何做到这一点,因为会满足“端口不安全”条件并且不会发生 URL 重定向。如果主机是 IP 并且安全,我需要以某种方式添加重定向条件,然后重定向到
https://domain
标签: asp.net redirect iis https url-redirection