当前在尝试通过 ALB 访问我的应用程序时收到 net::ERR_CERT_COMMON_NAME_INVALID
。
这是我当前的设置:
- 使用 AWS Certificate Manager 创建了涵盖
example.com
和*.example.com
的 SSL 证书。 - 负载均衡器后面有 2 个服务器 ec2 实例,另一个负载均衡器后面有 2 个客户端实例。
- 我的 Route 53 托管区域中指向客户端 ALB 的别名记录。
- 两个 ALB 都附加了
example.com
的 SSL 证书。 - 两个 ALB 都有一个
HTTPS: 443
监听器,将https
流量转发到端口 80 上的 ec2 实例。 - 服务器 ALB 安全组允许来自客户端 ALB 安全组的入站流量和出站到服务器实例安全组的流量。
- 客户端 ec2 实例中的应用程序是指向服务器 ALB 的 React 应用程序,地址为
https://xxxxxxxxxx.elb.amazonaws.com/api
通过 https://example.com
访问应用程序会导致控制台中出现 net::ERR_CERT_COMMON_NAME_INVALID
,浏览器显示:
Error: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “xxxxxxxxxx.elb.amazonaws.com” which could put your confidential information at risk.
如果有帮助,我很乐意提供更多详细信息。
最佳答案
如果您拥有自己的域 example.com
并带有正确的 SSL 证书,则您不能使用 https://xxxxxxxxxx.elb.amazonaws.com/api
是 AWS 域。原因是 SSL 证书适用于 example.com
,而不适用于 https://xxxxxxxxxx.elb.amazonaws.com/api
。
您必须修改您的应用程序代码以仅使用 example.com
。
关于amazon-web-services - AWS ELB 导致 net::ERR_CERT_COMMON_NAME_INVALID 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67756492/