## TL;DR
Empty reply means the TCP connection succeeded but the server closed it without sending HTTP: the upstream crashed on the request, a proxy cut the connection, or the server requires something (TLS, auth, Host header) your curl did not provide. Reproduce with verbose curl to see exactly where the conversation dies, then check the server side for the matching error.

## The query
```text
curl "(52) Empty reply from server": upstream debugging
```

## Use this when
- curl fails with empty reply from server
- The server accepts connections but sends nothing
- Distinguishing client vs server faults
- After server or proxy changes

## Not for when
- DNS resolution failures
- TLS handshake errors (different curl code)
- Connection refused (nothing listening)

## Steps

### Step 1: Reproduce with verbose output
Run curl with verbose flags to see the connection setup: TCP connect, TLS handshake if any, request sent, then the empty close. The point of death narrows the cause enormously.
Expected output: the exact stage where the server goes silent.

### Step 2: Check the server logs at the same timestamp
Correlate with the server's access and error logs. A request that never appears in access logs died before the HTTP layer (proxy, firewall, TLS); one that appears with a 500 or a crash trace died inside the app.
Expected output: the server-side view of the same request.

### Step 3: Test bypassing proxies and load balancers
Hit the upstream directly, skipping any proxy or LB in the path. If direct works, the middlebox is closing the connection; if direct fails too, the server itself is at fault.
Expected output: the failing hop isolated.

### Step 4: Check for protocol mismatches
Plain HTTP to a TLS port, HTTP/2 to an HTTP/1-only server, or a missing Host header can all produce silent closes. Match the client's protocol to what the server expects.
Expected output: protocol alignment confirmed, or the mismatch fixed.

### Step 5: Look for server-side crashes on the request
If the server logs show a crash or panic correlated with the request, the empty reply is the symptom of the crash. Fix the crash; the curl error was just the messenger.
Expected output: the underlying server bug identified and fixed.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_1Dkeg8_8spoVwEnsHBLSlQ
