[英]Change Node js server (on elastic beanstalk AWS) url to HTTPS
I am trying to deploy my React js app using an AWS s3 bucket.我正在尝试使用 AWS s3 存储桶部署我的 React js 应用程序。 However, I am fairly new to AWS and am having quite a difficult time.但是,我对 AWS 还很陌生,并且过得很艰难。 This react app communicates with a node / express server, which is hosted on an elastic beanstalk environment.这个反应应用程序与一个节点/快速服务器通信,该服务器托管在弹性 beanstalk 环境中。 I previously had the following error:我以前有以下错误:
Mixed Content: The page at 'https://myReactApp.s3.amazonaws.com/index.html' was loaded over HTTPS, but requested an insecure resource 'http://myElasticBeanstalkServer.us-east-1.elasticbeanstalk.com/signIn?username=lsharon&password=test4321'. This request has been blocked; the content must be served over HTTPS.
I began the process of trying to figure out how to "convert" my EB url into HTTPS.我开始尝试弄清楚如何将我的 EB url“转换”为 HTTPS。 I found lots of information about obtaining an ssl certificate.我发现了很多关于获得 ssl 证书的信息。 I am pretty confused on the whole process.我对整个过程很困惑。 Here is what I did:这是我所做的:
Currently, when I load my static web page in the browser, it renders fine and says secure.目前,当我在浏览器中加载我的 static web 页面时,它呈现良好并显示安全。 However, when I click one of my buttons (therefore sending a fetch request to my EB url), it ALSO works but changes to insecure and says my ssl is insecure.但是,当我单击其中一个按钮(因此向我的 EB url 发送获取请求)时,它也可以工作,但会更改为不安全,并说我的 ssl 不安全。
I do apologize for all the questions.我为所有的问题道歉。 I just feel rather lost and seem to be finding lots of information but can't seem to make it work quite right.我只是觉得很迷茫,似乎找到了很多信息,但似乎无法让它正常工作。 If anyone could help me out, I sure would appreciate it.如果有人可以帮助我,我肯定会很感激。
To answer your first question, you have to setup DNS somewhere, either in your Google Domains account or in Route53 depending on who you want to use as your DNS host, pointing the domain name to the load balancer.要回答您的第一个问题,您必须在某处设置 DNS,无论是在您的 Google Domains 帐户中还是在 Route53 中,具体取决于您希望将谁用作 DNS 主机,将域名指向负载均衡器。
I connect to this API using the EB url...not my domain name.我使用 EB url 连接到这个 API ......不是我的域名。 How can I use my ssl certificate to secure my server url?如何使用我的 ssl 证书来保护我的服务器 url?
You have to change your front-end application to use the domain that matches the SSL certificate when making API calls (and also use https
instead of http
for those API calls). You have to change your front-end application to use the domain that matches the SSL certificate when making API calls (and also use https
instead of http
for those API calls). There is no other option if you want the web browser to stop complaining about these security issues.如果您希望 web 浏览器停止抱怨这些安全问题,没有其他选择。
To answer your second question, SSL certificates in AWS Certificate Manager can be attached to a load balancer which will handle terminating the SSL for you.要回答您的第二个问题,可以将 AWS Certificate Manager 中的 SSL 证书附加到负载均衡器,该负载均衡器将为您终止 SSL。 The load balancer can still communicate with the EC2 instance using non-encrypted HTTP.负载均衡器仍然可以使用未加密的 HTTP 与 EC2 实例通信。 So all you need to do is attach the SSL certificate to the port 443 listener in the load balancer.因此,您需要做的就是将 SSL 证书附加到负载均衡器中的端口 443 侦听器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.