I work for a company that has strict IT policy. I work behind a proxy and i mostly use Proxifier or sometimes set proxy in Windows setting.
I am developing API with Node.js and at first just to test I created a simple route that makes a call to 'https://jsonplaceholder.typicode.com/posts'. Whenever I test my route in Postman, I get error "Error: self signed certificate in certificate chain" in command prompt where node js is running.
But when I test 'https://jsonplaceholder.typicode.com/posts' directly in Postman, it works.
here is the simple code I wrote to test:
exports.testing = async(req, res, next) => {
try {
const data = await axios.get("https://jsonplaceholder.typicode.com/posts")
console.log({"Data": data.data})
}catch(err){
console.error({"ERROR": err});
}
}
What I have tried:
npm config set strict-ssl false --global (didn't help, i assume this is for downloading npm packages)
npm config set cafile /path/to/your/cert.pem --global (didn't help)
set NODE_TLS_REJECT_UNAUTHORIZED=0 (didn't help)
set NODE_EXTRA_CA_CERTS=/path/to/your/cert.pem (didn't help)
P.S.
When I use mobile data, it works perfectly