Axios doesn't address that situation so far - you can try:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
BUT THAT'S A VERY BAD IDEA since it disables SSL across the whole node server.
Or, you can configure axios to use a custom agent and set rejectUnauthorized
to false
for that agent as mentioned here.
Example:
const https = require('https');
const axios = require('axios')
//or
// import https from 'https';
// import axios from 'axios';
// At instance level
const instance = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
});
instance.get('https://something.com/foo');
// At request level
const agent = new https.Agent({
rejectUnauthorized: false
});
axios.get('https://something.com/foo', { httpsAgent: agent });