#577
fix(proxy): keep reading the request body after an early response
Written by an AI agent (Claude) on behalf of @jasonkuhrt.
- When an app answered a request before reading its body, such as a 413 for an upload, the proxy stopped reading the rest of the body once the response finished, so the next request on that HTTP/1.1 connection never got an answer.
- Node emits
closeon the response when it finishes, and the handler meant for client disconnects destroyed the backend request while the body was still being piped into it, which leftrequnpiped and paused. That handler now unpipes and resumesreqbefore destroying the backend request, as the backend error path does since #489. - Fixes #576.
A test covers it: an app rejects a 1 MB upload with a 413 after the first 1 KB, the client sends the rest and then a GET on the same connection, and the GET gets its 200. Without the change it fails on main in every run.
@jasonkuhrt is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.