2017-07-17 57 views
0

我有一個JS應用程序在aws ec2上運行 - 對應用程序的原始調用是http - 但是當更改爲https時,調用被拒絕 - 對不起,這個不詳細 - 項目包括mongodb節點js等....如果有人覺得他們可能會提供幫助,將提供更多的細節和可能需要的代碼JS應用程序未通過https運行aws

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 
+0

你將不得不包括更多的細節,特別是代碼。 –

回答

0

我猜你有2個問題

  1. 面對你的應用程序的NodeJS:沒有定義集合變量,你需要檢查這個變量聲明。

  2. 混合內容問題:要解決此問題,您需要在API中使用https。由於安全原因,Web瀏覽器需要阻止來自https的呼叫。

+0

謝謝你 - 是的 - 我試圖改變電話到https - 似乎是顯而易見的 - 但該應用程序然後只是拒絕連接.... – Brian

相關問題