英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论