/errors/curl/empty-reply-from-server
curl: (52) Empty reply from server
- 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:
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: $?"
waitOutput
curl: (52) Empty reply from server exit status: 52
Compare with similar errors
| Message | What happened |
|---|---|
| curl: (7) Failed to connect | nothing accepted the TCP connection |
| curl: (52) Empty reply from server | connection accepted, closed with zero bytes of response |
| curl: (56) Recv failure: Connection reset by peer | the server reset the connection (RST) instead of closing it |
| curl: (28) Operation timed out | the server kept the connection open and never answered |
Find out where it breaks
curl -v http://HOST:PORT/pathIn 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. Usehttps://. - Server logs: an application that crashes on a specific request (large header, unexpected body) produces exactly this error.
- Proxies: unset
http_proxy/https_proxyor use--noproxy '*'to rule out a proxy that drops the request. - Containers: a server bound to
127.0.0.1inside a container is unreachable through the published port; bind to0.0.0.0.