Skip to content

/errors/curl/empty-reply-from-server

curl: (52) Empty reply from server

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · curl 8.21.0 (x86_64-w64-mingw32) libcurl/8.21.0 Schannel zlib/1.3.2updated
tool
curl
exit code
52
versions
curl 7.x, curl 8.x
os
linux, macos, windows

curl: (52) Empty reply from server means the TCP connection was established, curl sent its request, and the server closed the connection without sending any HTTP response, not even a status line. curl exits with code 52 (CURLE_GOT_NOTHING). The problem is on the server side or in something in between: look at the server's and the proxy's logs, and check that you are talking HTTP to an HTTP port and HTTPS to an HTTPS port.

Reproduce the error

A TCP server on port 4880 that reads the request and closes the socket without answering:

bash
node -e 'require("net").createServer((s) => s.once("data", () => s.end())).listen(4880, "127.0.0.1"); setTimeout(() => process.exit(0), 4000)' &
sleep 1
curl -sS http://127.0.0.1:4880/
echo "exit status: $?"
wait

Output

curl: (52) Empty reply from server
exit status: 52

Compare with similar errors

MessageWhat happened
curl: (7) Failed to connectnothing accepted the TCP connection
curl: (52) Empty reply from serverconnection accepted, closed with zero bytes of response
curl: (56) Recv failure: Connection reset by peerthe server reset the connection (RST) instead of closing it
curl: (28) Operation timed outthe server kept the connection open and never answered

Find out where it breaks

bash
curl -v http://HOST:PORT/path

In the verbose output, Connected to shows that TCP worked; for HTTPS, the SSL connection using line shows the TLS handshake finished. If the last line before the error is the request you sent (> GET /path HTTP/1.1), the server or a proxy closed the connection after reading it.

Common checks:

  • Scheme and port: curl http://host:443/ sends plain HTTP to a TLS port. Use https://.
  • Server logs: an application that crashes on a specific request (large header, unexpected body) produces exactly this error.
  • Proxies: unset http_proxy/https_proxy or use --noproxy '*' to rule out a proxy that drops the request.
  • Containers: a server bound to 127.0.0.1 inside a container is unreachable through the published port; bind to 0.0.0.0.

Sources