[英]How to configure Nodejs that is in AWS EC2 Instance to accept HTTPS request from client side
I would like to ask about how to configure Nodejs (backend/server) to accept HTTPS request from client side (Front end). 我想问一下如何配置Node.js(后端/服务器)以接受来自客户端(前端)的HTTPS请求。
What we did. 我们做了什么。
The problem: 问题:
What did we missed? 我们错过了什么?
If I understand you correctly, you have a Cloudfront distribution serving angular which is then attempting to connect to an EC2 instance - I presume the IP address or public DNS entry for the EC2 is hard-coded into the angular code. 如果我正确理解,则您有一个提供角度服务的Cloudfront发行版,然后尝试连接到EC2实例-我认为EC2的IP地址或公共DNS条目已硬编码为角度代码。
This is not a good arrangement - if your EC2 goes down or the IP address changes you will need to push a new site to S3 - and then this change will take time to propagate through Cloudfront. 这不是一个很好的安排-如果您的EC2发生故障或IP地址更改,则需要将新站点推送到S3-然后此更改将需要一些时间才能通过Cloudfront传播。
What you should rather be doing is this. 您应该这样做的是。
(This is an incredibly simplistic way of doing things that leaves your EC2 open to the internet etc etc). (这是一种非常简单的处理方式,使您的EC2可以访问互联网等)。
You should also give serious thought to putting your EC2 into an autoscaling group that spans at least two availability zones, and to setting its minimum size to ensure at least servers are running at any one time. 您还应该认真考虑将EC2放入一个跨越至少两个可用性区域的自动伸缩组,并设置其最小大小以确保至少任何一次服务器都在运行。
AWS EC2 instances can go away at any time, and when they do your app goes down with them. AWS EC2实例可以随时消失,当它们运行时,您的应用程序也会随之消失。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.