https
モジュールを使用してリクエストを行う場合は、リクエストでrejectUnauthorized
オプションを有効にする必要があります。公式ドキュメントごとに:私たちはあなたが要求を行っている方法を正確の感触を得ることができるので、https://nodejs.org/api/https.html#https_https_request_options_callback
const https = require('https');
var options = {
hostname: 'your-hostname',
port: 443,
path: '/the-path-to-access',
method: 'GET',
rejectUnauthorized: false // this is the line you need to add!
};
var req = https.request(options, (res) => {
console.log('statusCode: ', res.statusCode);
console.log('headers: ', res.headers);
res.on('data', (d) => {
process.stdout.write(d);
});
});
req.end();
req.on('error', (e) => {
console.error(e);
});
あなたはサンプルリクエストを投稿できます。 –
私はちょうどMacにノードjsを再インストールすることによってばかげた質問を解決しました。どのような時間の無駄です! COMODO証明書を持つhttpsサーバーにはカスタムCAはまったく必要ありません。 :( – Slavik