-2

I am deploying my app to cloud using Amazon services. I successfully deployed Back-end (NodeJS Express + MongoDB) with AWS EC2 at http://18.170.213.96:8080/ and Frontend (ReactJS) with AWS Amplify at https://master.d1p21clff7pjln.amplifyapp.com/.

But I can not login to my app because this error:

enter image description here

It seems that my FE server is HTTPS while my BE server is HTTP. This is my Instance in AWS EC2

enter image description here

I want to ask how to convert BE server to HTTPS or FE server to HTTP or any ways that help me solve this problem. This is the first time I try to deploy and I am stuck now. Thank you very much!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Stern
  • 29
  • 6

1 Answers1

1

You have a few options to set up HTTPS for the backend.

  • Purchase a domain, and set up a SSL certificate on your EC2 instance with letsencrypt.org for free. Keep in mind that if the instance gets replaced or you need to add more, you will need to set it up each time.
  • Purchase a domain, set up an ALB in front of your EC2 instance(s), and configure your certificate to the ALB.
  • Set up an AWS API Gateway of REST API type, and configure as a proxy or directly configure the paths for your API and integrate to your EC2 URL. API Gateway supports SSL out of the box without having to set your own domain (you can if you want to). You will probably have to configure CORS options as well to allow communication between different domains.
chamal
  • 858
  • 6
  • 13