Skip to content

Signal Connection: close when the server closes an HTTP/1 connection#183

Merged
williamthome merged 3 commits into
mainfrom
fix/signal-connection-close-on-server-close
Jun 23, 2026
Merged

Signal Connection: close when the server closes an HTTP/1 connection#183
williamthome merged 3 commits into
mainfrom
fix/signal-connection-close-on-server-close

Conversation

@williamthome

Copy link
Copy Markdown
Member

Description

roadrunner now advertises Connection: close on the final HTTP/1 response whenever the server, not the client, is about to close a connection it was otherwise keeping alive. Without that header a fronting proxy (nginx, ngrok) treats the connection as reusable and can race a fresh request onto a socket the server is already dropping. Two paths now signal it: a buffered or sendfile response that reaches max_keep_alive_requests, and stream / loop responses (including SSE), which always close once the writer finishes. RFC 9112 §9.6 defines the close option as "a signal that the sender will close this connection after completion of the response", so a server that will close has to say so or the peer assumes reuse.

Response that hits max_keep_alive_requests, before: 200 OK then the socket closes with no warning; after: 200 OK plus Connection: close, then closes.
Streamed or SSE response, before: 200 OK with Transfer-Encoding: chunked then closes silently; after: the same plus Connection: close.

@williamthome williamthome merged commit dc33e68 into main Jun 23, 2026
15 checks passed
@williamthome williamthome deleted the fix/signal-connection-close-on-server-close branch June 23, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant