tunneling socket could not be established, EPROTO 139829749196736

huangapple go评论88阅读模式
英文:

tunneling socket could not be established, EPROTO 139829749196736

问题

我在从服务器调用Node.js应用程序时遇到了问题,错误信息如下:"Error: 无法建立隧道套接字,原因=写入 EPROTO 139829749196736:error:1408F10B:SSL routines:ssl3_get_record:wrong version"

我使用了以下代码片段:

var options = {
    'method': 'POST',
    'url': process.env.QATAPIPATH + process.env.APIPATH + parameter,
    'headers': {
        'Content-Type': 'application/json'
    },
    ignoreTLS: true,
    secure: false,
    body: JSON.stringify({
        "data": req.body.data
    })
};
英文:

I am facing the issue while calling Node js application from server, "Error: tunneling socket could not be established, cause=write EPROTO 139829749196736:error:1408F10B:SSL routines:ssl3_get_record:wrong version"

I used this code snippet below:

 var options = {
                'method': "POST",
                'url': process.env.QATAPIPATH + process.env.APIPATH + parameter,
                'headers': {
                    'Content-Type': 'application/json'
                },
                ignoreTLS: true,
                secure: false,
                body: JSON.stringify({
                    "data": req.body.data
                })
            };

答案1

得分: 0

以上的SSL错误是因为客户端无法验证自签名服务器证书的信任链。

解决这些错误的最简单方法是使用“rejectUnauthorized”

https.request({ 
  ....,
  rejectUnauthorized: false,
}, ...)

或者将其设置为环境变量

NODE_TLS_REJECT_UNAUTHORIZED=0

对于Linux

export NODE_TLS_REJECT_UNAUTHORIZED=0
英文:

The above SSL errors are thrown because the client is not able to verify the trust chain of the self-signed server certificate

The easiest solution to resolve these errors is to use the “rejectUnauthorized”

> https.request({ 
>       ....,
>       rejectUnauthorized: false,
>     }, ...)

or set it as an environment variable

NODE_TLS_REJECT_UNAUTHORIZED=0

for Linux

export NODE_TLS_REJECT_UNAUTHORIZED=0

huangapple
  • 本文由 发表于 2023年1月5日 12:49:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/75013953.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定