如何禁用SSL验证nodejs Loopback Request Plugin

时间:2017-10-27 12:28:30

标签: javascript node.js ssl loopbackjs

我是nodejs和loopback的新手。我想发一个帖子请求。连接到我们的dev api时工作正常。但是当使用https连接到我们的生产API时。它好像被封锁了。

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));

1 个答案:

答案 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找到了解决方案。