JS应用程序没有在aws上运行https

时间:2017-07-17 03:22:43

标签: javascript https

我有一个在aws ec2上运行的JS应用程序 - 对应用程序的原始调用是http - 但是当更改为https时,调用被拒绝 - 抱歉这不详细 - 该项目包括mongodb节点js等....如果任何人都觉得他们可能会提供帮助,会提供更多可能需要的细节和代码

inspect =混合内容:“https://mediataplatform.com/COU_TEST.html”的页面是通过HTTPS加载的,但是请求了一个不安全的XMLHttpRequest端点“http://ec2-54-159-65-110.compute-1.amazonaws.com:3000/storeDetails”。此请求已被阻止;内容必须通过HTTPS提供。

strVar += "          <form id=\"loginform\" name=\"loginform\" 
method=\"POST\" action=\"http:\/\/ec2-54-159-65-110.compute-
1.amazonaws.com:3000\/storeDetails\">";
strVar += "            <input type=\"hidden\" id = 'selectedEmotion' name = 
\"selectedEmotion\" value='99'>";

    ReferenceError: collection is not defined
    at /home/ubuntu/expressproject/routes/index.js:118:3
    at Layer.handle [as handle_request] 
    (/home/ubuntu/expressproject/node_modules/express/lib/router/layer.js:95:5)
    at next 
   (/home/ubuntu/expressproject/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch 
   (/home/ubuntu/expressproject/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] 
   (/home/ubuntu/expressproject/node_modules/express/lib/router/layer.js:95:5)
    at 
   /home/ubuntu/expressproject/node_modules/express/lib/router/index.js:277:22
    at Function.process_params 
   (/home/ubuntu/expressproject/node_modules/express/lib/router/index.js:330:12)
    at next 
   (/home/ubuntu/expressproject/node_modules/express/lib/router/index.js:271:10)
    at /home/ubuntu/expressproject/node_modules/express-mongo-db/index.js:23:5

1 个答案:

答案 0 :(得分:0)

我猜你面临着2个问题

  1. 您的NodeJS app:未定义集合变量,您需要检查此变量声明。

  2. 混合内容问题:要解决此问题,您需要在API中使用https。由于安全性,Web浏览器需要阻止从https进行呼叫的http请求。