node.js “在建立安全 TLS 连接之前客户端网络套接字已断开连接”,节点 10

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53593182/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:56:11  来源:igfitidea点击:

"Client network socket disconnected before secure TLS connection was established", node 10

node.jsssl

提问by Qiulang

When I send request to google api (using either axios or just https), e.g. https://www.googleapis.com/blogger/v3/blogs/2399953?key=...

当我向 google api 发送请求时(使用 axios 或仅使用 https),例如 https://www.googleapis.com/blogger/v3/blogs/2399953?key=...

I always hit the "Client network socket disconnected before secure TLS connection was established" error.

我总是遇到“在建立安全 TLS 连接之前断开客户端网络套接字”错误。

But if I send request to https://api.github.com, it works just fine. I have googled the error, but I can't find much useful information. Here https://github.com/nodejs/node/issues/21088said if the server uses TLS 1.0, it may happen but apparently it is not my case.

但是如果我将请求发送到https://api.github.com,它就可以正常工作。我用谷歌搜索了错误,但我找不到太多有用的信息。这里https://github.com/nodejs/node/issues/21088说如果服务器使用 TLS 1.0,它可能会发生,但显然这不是我的情况。

I also try googleapisbut still hit the same error.

我也尝试过googleapis,但仍然遇到相同的错误。

Any idea how to fix the error ?

知道如何修复错误吗?

回答by Akintunde

In case, someone else faces this same problem, a possible solution (if you are using windows OS), is to follow the process below:

如果其他人面临同样的问题,一个可能的解决方案(如果您使用的是 Windows 操作系统)是按照以下过程操作:

  • Press the Windows Key
  • Search For Internet Options
  • Click on "Internet Options"
  • Click On "Connection"
  • Go to LAN Settings
  • Uncheck "Use Proxy Server for LAN ...."
  • 按 Windows 键
  • 搜索 Internet 选项
  • 点击“Internet选项”
  • 点击“连接”
  • 进入局域网设置
  • 取消选中“为 LAN 使用代理服务器......”

It should work but the permanent solution is to make sure you turn all software that might be automatically setting up proxy for you.

它应该可以工作,但永久的解决方案是确保您打开所有可能自动为您设置代理的软件。

回答by Rennay Dorasamy

This error could be related to your proxy. If on Unix, check your HTTP_PROXY and HTTPS_PROXY environment variables.

此错误可能与您的代理有关。如果在 Unix 上,请检查您的 HTTP_PROXY 和 HTTPS_PROXY 环境变量。