繁体   English   中英

HTTPS 用于运行 Python Flask 应用程序的 Elastic Beanstalk (AWS)。 无法得到URL来解决

[英]HTTPS for Elastic Beanstalk (AWS) running Python Flask application. Unable to get URL to resolve

我使用 Flask 框架创建了一个小型 Python 站点。 我已使用 Elastic Beanstalk 将其上传到 AWS,并尝试配置环境以确保启用 HTTPS。 我以前用 ASP.NET 和 IIS 做过这个,但不是 Python / ZE9713AE04A02A810D9ZF3DD96422F3。 (我对这个“堆栈”很陌生)。 如果我访问底层的弹性豆茎 URL 我可以访问该站点(自己尝试)

http://flask-priceline.f8n9uir55a.ap-southeast-2.elasticbeanstalk.com

但是,当我尝试使用 HTTPS 或 HTTP 访问正确的 DNS 时,例如

http://plmonitoring.in-daws.api.net.au/https://plmonitoring.in-daws.api.net.au/

我得到:

无法访问此站点 plmonitoring.in-daws.api.net.au 的服务器 IP 地址找不到。 尝试运行 Windows 网络诊断。 DNS_PROBE_FINISHED_NXDOMAIN

这是我所做的。 我已经在 AWS 中创建了一个有效证书。 我还在 Route 53 中设置了适当的记录集/CNAMES,以便我的别名指向我创建的负载均衡器。

我使用经典负载均衡器创建了我的 Elastic Beanstalk 环境。 负载均衡器位于公有子网中,运行 web 服务器的 EC2 实例位于私有子网中。 (此 VPC 已存在且配置正确)。 我在负载均衡器上创建了以下监听器:

在此处输入图像描述

我通过以下.ebextensions 配置文件完成了这项工作:

option_settings:
  aws:elb:listener:443:
    SSLCertificateId: arn:aws:acm:ap-southeast-2:xxxxxxxxxxxxx:certificate/xxxxxxxxxxxxxxxxxxxx
    ListenerProtocol: HTTPS
    InstancePort: 80

我的安全组中还设置了以下设置(我尝试将 HTTP 80 添加为负载均衡器的入站和 EC2 的出站/EC2 的入站,而无需更改)。 这是入站负载均衡器安全组:

在此处输入图像描述

负载均衡器输出:

在此处输入图像描述

EC2 输入:

在此处输入图像描述

EC2 输出:

在此处输入图像描述

I also added this sample to the.ebextensions folder in the hopes it would redirect HTTP to HTTPS in case the user typed in HTTP instead of HTTPS - https://github.com/awsdocs/elastic-beanstalk-samples/blob/master/配置文件/aws-provided/security-configuration/https-redirect/python/https-redirect-python.config

最糟糕的人为错误。 将记录设置为 IPV4,而不是 CNAME.. 问题已解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM