Console9

curl: (56) Recv failure: Connection reset by peer

Fix curl error 56 when the server or an intermediary resets the TCP connection during data transfer.

curl: (56) Recv failure: Connection reset by peer

curl produces error 56 when the server or an intermediary resets the TCP connection during data transfer.

When curl Produces This Error

curl displays error 56 after the TCP connection is established but before the full response is received. The server or a network device (firewall, load balancer, proxy) sends a TCP RST, terminating the connection mid-transfer.

What Causes Connection Reset Error 56 in curl

A web application firewall (WAF) or intrusion detection system may block the request. The server may close idle connections (timeout). A TLS version mismatch can cause the server to reset after the handshake. Network MTU issues can fragment packets and trigger resets.

How to Fix Connection Reset Error 56 in curl

  1. Enable verbose output to identify where the reset occurs:

    curl -v https://example.com 2>&1
  2. Try a different TLS version:

    curl --tls-max 1.2 https://example.com
    curl --tlsv1.3 https://example.com
  3. Check if a proxy or firewall is interrupting the connection by testing from a different network.

How to Verify the Fix

A successful request completes without error 56 and returns the full response body.