Search code examples
amazon-web-servicesamazon-ec2https

How to enable HTTPS for my backend on AWS EC2 to work with my frontend on Netlify?


I've successfully deployed my full-stack project, with the frontend using Netlify and the backend initially using Render. However, due to slow response times on Render, I decided to move my backend to an AWS EC2 instance.

I launched the EC2 instance, connected via SSH, cloned my backend project from GitHub, and successfully ran the project. The backend responds with HTTP, but my frontend on Netlify requires HTTPS responses to function properly.

Here is the error message: "Mixed Content: The page at 'netlify.app' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint. This request has been blocked; the content must be served over HTTPS."

Could someone guide me on how to configure my EC2 instance to serve HTTPS responses?


Solution

  • You have to get your own domain, and setup ssl certificate for it. You can do it through combination of application load balancer, route64 and aws acm:

    Or setup ssl directly on the instance. You can use https://letsencrypt.org/ to get free public certificate for your own domain (not aws doman, but your own that you actually own!).