【问题标题】:Why does a NodeJS ssl server respond to cURL with (52) Empty reply from server?为什么 NodeJS ssl 服务器使用 (52) 来自服务器的空回复来响应 cURL?
【发布时间】:2021-04-15 05:56:49
【问题描述】:

我可以使用以下命令通过 ssl 成功访问 NodeJS 服务器:

curl --insecure https://ipaddress

但是当使用以下命令时,我从服务器收到 (52) 空回复:

curl --insecure ipaddress:443

我怎样才能使后者工作? 我需要在似乎不接受前者的 DNS 中指定地址。

我的 curl 版本是 7.68.0,似乎是最新的。

【问题讨论】:

  • https 协议 != 443 协议
  • @Saddy 我不确定如何回答您的陈述。服务器监控443,有ssl证书。

标签: node.js ssl curl https


【解决方案1】:

curl --insecure ipaddress:443

鉴于没有给出明确的https://,curl 将使用默认协议 HTTP。只是,服务器在端口 443 上需要 HTTPS,因此请求将失败。没有办法让这个纯 HTTP 工作,因为服务器不希望这个端口上有纯 HTTP。

curl --insecure https://ipaddress

在这种情况下,它是明确给出的https://。因此它将在端口 443 上使用 HTTPS(默认为 HTTPS)并成功。

【讨论】:

  • 谢谢。有没有办法告诉 cURL 使用不带 https 前缀的 https 协议?
  • @user3877654:不。这正是 URL 前缀的用途。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-12-27
  • 2015-11-05
  • 1970-01-01
  • 1970-01-01
  • 2021-05-07
  • 2015-05-05
  • 1970-01-01
相关资源
最近更新 更多