xxxxxxxxxx
const https = require('https');
const fs = require('fs');
// Path to the CA bundle file
const caBundlePath = '/path/to/ca-bundle.crt';
const options = {
// Specify the URL you are trying to access
hostname: 'example.com',
port: 443,
path: '/',
method: 'GET',
ca: fs.readFileSync(caBundlePath), // Read and provide the CA bundle content
};
const req = https.request(options, (res) => {
// Handle the response
console.log('statusCode:', res.statusCode);
// ... rest of the code to process the response
});
req.on('error', (e) => {
console.error('Error:', e);
});
req.end();