【问题标题】:JS app not running over https on awsJS 应用程序未在 aws 上通过 https 运行
【发布时间】:2017-07-17 03:22:42
【问题描述】:

我有一个在 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

【问题讨论】:

  • 您必须包含更多细节,尤其是代码。

标签: javascript https


【解决方案1】:

我猜你面临两个问题

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

  2. 混合内容问题:要解决此问题,您需要在 API 中使用 https。出于安全考虑,Web 浏览器需要阻止从 https 调用的 http 请求。

【讨论】:

  • 谢谢 - 是的 - 我尝试将调用更改为 https - 似乎很明显 - 但是应用程序会完全拒绝连接....
猜你喜欢
  • 2021-01-16
  • 2016-02-06
  • 2018-11-08
  • 2020-05-08
  • 2020-12-26
  • 2017-11-07
  • 1970-01-01
  • 2021-06-14
  • 2021-09-25
相关资源
最近更新 更多