2017-10-27 26 views
0

私はnodejsとループバックの両方が初めてです。私は投稿要求をしたい。私たちのdev apiに接続するときにそのうまく動作します。しかし、私たちのプロダクションAPIにhttpsで接続すると。そのブロックされているようです。SSL検証を無効にする方法nodejsループバックリクエストプラグイン

var request = require('request'); 

request.post({ 
    url: "",//removed for obvious reasons 
    headers: { 
     'Content-Type': 'application/x-www-form-urlencoded' 
    }, 
    form: { 
     myfield: "myfieldvalue" 
    } 
},function (response, err, body){ 
    console.log('Body:',JSON.parse(body)); 
}.bind(this)); 
+0

[NodeJS Request PostはHTTPS Webサイトで動作しません](https://stackoverflow.com/questions/46968937/nodejs-request-post-not-working-for-https-website) –

+0

の重複がありますか?スニペットも同じです! –

答えて

0
rejectUnauthorized: false,//add when working with https sites 
requestCert: false,//add when working with https sites 
agent: false,//add when working with https sites 

私が働いてそれを得ました。その解決策はhereにあります。

関連する問題