Signal Connection: close when the server closes an HTTP/1 connection#183
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
roadrunner now advertises
Connection: closeon 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 reachesmax_keep_alive_requests, and stream / loop responses (including SSE), which always close once the writer finishes. RFC 9112 §9.6 defines thecloseoption 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 OKthen the socket closes with no warning; after:200 OKplusConnection: close, then closes.Streamed or SSE response, before:
200 OKwithTransfer-Encoding: chunkedthen closes silently; after: the same plusConnection: close.