0

I have an Angular app deployed to GitHub (https://santhoshvenkateswaran.github.io/aggrow) And a flask API setup with AWS EC2 Machine.

When I try to make a call from my UI to the AWS IP, I get the following error

Mixed Content: The page at 'https://santhoshvenkateswaran.github.io/aggrow/home' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://13.235.82.185:8080/api/train'. This request has been blocked; the content must be served over HTTPS.

The baseURL for the HTTP requests is "http://13.235.82.185:8080/api/train"

Kindly help me fix this. I tried deploying the app on heroku and faced the same issue.

Error on Console while calling API

Santhosh
  • 43
  • 1
  • 1
  • 6
  • the error says pretty clear that you cannot make `http` calls from a `https` page. you will have to make https sertificates and host your api under https rather than just http – Andrei Jun 30 '20 at 13:14
  • have you tried moving your http to https? it will probabaly resolve it. Because endpoint is http. – Wahab Shah Jun 30 '20 at 13:15
  • Do not redirect HTTP to HTTPS. Redirects may break API clients as, unlike browsers, they may not be configured to follow redirects. Even if they followed the redirect, many API clients will change a POST request into a GET request, breaking RESTful APIs. – Thiago Da Anunciação Jun 30 '20 at 13:17
  • In that case, how do I serve the AWS EC2 flask app on a `https` page? – Santhosh Jun 30 '20 at 13:18

0 Answers0