简体   繁体   中英

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

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM