1
votes

I have the following setup:

  1. React.js App on Cloudfront (example.eu) -> Certificate for *.example.eu and example.eu
  2. Fargate Python FastAPI instance on port 5000
  3. Load Balancer internet facing http://***.eu-central-1.elb.amazonaws.com/

I can visit my website https://example.eu just fine

So in my front-end I defined the Load Balancer URL for doing the requests to the Fargate instance --> GET http://***.eu-central-1.elb.amazonaws.com/users.

I clicked on the button on the website to fire the request to the backend but I get a mixed content error in the browser.

Well, I thought let's do the calls over https - I added a HTTPS on 443 listener and added the certificate created earlier. And if I deactivate the SSL verification (e.g. in Postman) that works fine but else I get in my browser the following error:

VM11:1 GET https://***.eu-central-1.elb.amazonaws.com/users net::ERR_CERT_COMMON_NAME_INVALID

Do I need another certificate for the load balancer URL? I checked out a lot of tutorials and they only create one for the domain. Do I need to add the certificate to my back-end?

I'm really confused how I can establish a proper https communication from example.eu over the load balancer https://***.eu-central-1.elb.amazonaws.com to my Fargate backend on port 5000.

Thanks

1

1 Answers

0
votes

Found the solution:

Go to your Route 53 and add an A entry with Alias Target to the ALB. Important: Add a subdomain in the name field: e.g. api.example.eu.

That's it :)