You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
consthttps=require('node:https');constoptions={hostname: 'self-signed.badssl.com',port: 443,path: '/',method: 'GET',};options.agent=newhttps.Agent({
...options,rejectUnauthorized: false,// <-- this should avoid self-signed cert errors});constreq=https.request(options,res=>{console.log('statusCode:',res.statusCode);console.log('headers:',res.headers);res.on('data',d=>{console.log('received: '+d.length);});});req.on('error',e=>{console.error(e);});req.end();
What is the expected behavior?
Expected rejectUnauthorized to be respected and no error to be thrown. This is how NodeJS behaves.
What do you see instead?
Error:
DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate
path: "https://self-signed.badssl.com/"
Additional information
Running the program with NODE_TLS_REJECT_UNAUTHORIZED="false" achieves the desired behavior, as does passing the option nested inside of a tls property on the request options (not the agent options):
What version of Bun is running?
1.1.7
What platform is your computer?
Darwin 23.4.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
Expected
rejectUnauthorized
to be respected and no error to be thrown. This is how NodeJS behaves.What do you see instead?
Error:
Additional information
Running the program with
NODE_TLS_REJECT_UNAUTHORIZED="false"
achieves the desired behavior, as does passing the option nested inside of atls
property on the request options (not the agent options):The text was updated successfully, but these errors were encountered: