Home > Mobile >  how to make aws public ip run on https on port 80 for nginx
how to make aws public ip run on https on port 80 for nginx

Time:03-14

I have hosted my node.js app on AWS EC2.

I don't have a domain name for my nodejs app. I am running it on Public IPv4 address 54.242.85.178.

I have a domain for my front end and its running on https so when https and http comes I am getting the following error:

Mixed Content: The page at 'https://www.wixten.com/query/622c64b4a12ed5002313daf5' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://54.242.85.178/answersapi/622c64b4a12ed5002313daf5'. This request has been blocked; the content must be served over HTTPS.

CodePudding user response:

The error says it all - you can't mix https and http. You have to go through your source code and eliminate all http urls and substitute them for proper https urls.

CodePudding user response:

Based on the error, your frontend is making HTTPS calls to an HTTP endpoint (on the ip 54.242.85.178), hence you have that error. I am guessing you're using ajax to make that call.

For a quick fix, you can update your frontend to make HTTP calls to your backend, This will sort out this issue, however this is HIGHLY NOT recommended but it will help you understand the issue better.

Ideally, you have to add an SSL certificate on your backend as well, then you can make HTTPS calls to it from your frontend.

  • Related