koichik / node-tunnel

Node HTTP/HTTPS Agents for tunneling proxies
MIT License
537 stars 78 forks source link

Error : tunneling socket could not be established, cause=Hostname/IP does not match certificate's altnames #41

Open adefirmanf opened 4 years ago

adefirmanf commented 4 years ago

Hey, I got the following an error. tunneling socket could not be established, cause=Hostname/IP does not match certificate's altnames

Here my code :

const tunnellingAgent = tunnel.httpsOverHttps({
  proxy: {
    ca: [fs.readFileSync('ca.pem')],
    host: "targetHost.com",
    port: 3129,
    proxyAuth: "user:pass",
  }
})

const options = {
  host: "api.ipify.org",
  url: "https://api.ipify.org/?format=text",
  method: "GET",
  agent: tunnellingAgent,
  checkServerIdentity: function (host, err) { }
}

R(options, (err, res) => {
  console.log(err)
  console.log(res)
})

The error seems similar to this issue https://github.com/request/request/issues/1777 and https://github.com/koichik/node-tunnel/issues/28

Add rejectUnauthorized: false option solve the issue but the certificate file just do nothing in there. https://github.com/request/request/issues/1777#issuecomment-321024249

So any other solution? Thanks

misdanwijaya commented 4 years ago

same problme here

foxsnow38 commented 2 years ago

same problem here to