【问题标题】:Putting AWS cloudfront in front of ec2 throws 502 error将 AWS cloudfront 放在 ec2 前面会引发 502 错误
【发布时间】:2020-09-07 14:26:28
【问题描述】:

我正在尝试通过以下方式将 SSL 添加到我的 EC2 实例,该实例在 node.js 服务器中托管我的 API:

1) 从证书管理器提供证书 2) 将 Cloudfront 放在我的 EC2 实例前面 3) 在Route53中添加记录集

在我实际添加 Route 53 中的记录集之前,我通过邮递员向我的健康检查 api 发出了 GET 请求

GET cloudfrontdistro.cloudfront.net/health

响应是带有消息的 502

We can't connect to the server for this app or website at this time. There might be too much traffic or a
configuration error. Try again later, or contact the app or website owner.

有关我的 Cloudfront 发行版的相关详细信息:

  • 我使用了自定义 SSL 证书 - 我从 ACM 获得的证书)
  • TLSv1.2_2018 安全策略
  • 源域名为ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com
  • 最低来源 SSL 协议是 TLSv1
  • 源协议策略仅限 HTTPS
  • HTTP 端口 80
  • HTTPS 端口 443
  • 查看器协议策略是将 HTTP 重定向到 HTTPS
  • 允许的 HTTP 方法是 GET、HEAD、OPTIONS、PUT、POST、PATCH、DELETE

任何帮助将不胜感激!蒂亚!

【问题讨论】:

    标签: ssl amazon-ec2 amazon-cloudfront


    【解决方案1】:

    我有类似的问题请看这个 (https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cnames-and-https-requirements.html).. 证书中的域名之一必须与您为 Origin Domain Name 指定的域名匹配。如果没有匹配的域名,CloudFront 会向查看器返回 HTTP 状态代码 502(错误网关)。

    【讨论】:

      猜你喜欢
      • 2022-01-20
      • 2014-12-12
      • 2020-10-13
      • 2021-03-25
      • 2016-07-20
      • 2018-01-21
      • 2021-11-10
      • 2020-12-28
      • 1970-01-01
      相关资源
      最近更新 更多