简体   繁体   English

添加 https 支持后,无法访问托管在 EC2 上的 Flask 应用程序

[英]Unable to access Flask app hosted on EC2 after adding https support

I have a Flask application currently using http being hosted on an ec2 instance.我有一个 Flask 应用程序,当前使用 http 托管在 ec2 实例上。 I want to host my application using https.我想使用 https 托管我的应用程序。 Currently with http, I am able to access my application (running on 0.0.0.0 port 80) by just accessing the ec2 public IP address (displays Running on http://0.0.0.0:80/ , and I am able to use my app at http://IP ). Currently with http, I am able to access my application (running on 0.0.0.0 port 80) by just accessing the ec2 public IP address (displays Running on http://0.0.0.0:80/ , and I am able to use my应用程序在http://IP )。

I am following this tutorial to test https support: https://blog.miguelgrinberg.com/post/running-your-flask-application-over-https .我正在按照本教程测试 https 支持: https://blog.miguelgrinberg.com/post/running-your-flask-application-over-https

When I add the most basic app.run(ssl_context='adhoc') to my program, the app is now Running on https://0.0.0.0:80/ , but I am unable to access my app at https://IP .当我将最基本的app.run(ssl_context='adhoc')添加到我的程序中时,该应用程序现在Running on https://0.0.0.0:80/ ,但我无法在https://上访问我的应用程序知识产权 I opened up my port 403 in my EC2 settings however I am still unable to communicate with my app using https...no response whenever I make a request.我在我的 EC2 设置中打开了端口 403,但是我仍然无法使用 https 与我的应用程序通信......每当我提出请求时都没有响应。

The same no response occurs when I run the application with gunicorn.当我使用 gunicorn 运行应用程序时,同样没有响应。 Am I missing something?我错过了什么吗? I think my requests are well formed, however I am never able to communicate with my app when using https.我认为我的请求格式正确,但是在使用 https 时,我永远无法与我的应用程序通信。

Simple way is put your instance behind ALB.简单的方法是将您的实例放在 ALB 后面。 ALB is not only load balancer, but also integrate ACM for free. ALB 不仅是负载均衡器,还免费集成 ACM。

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

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