Connection header for inflight return messages during shutdown
|Reported by:||Owned by:|
|nginx -V:||nginx version: 1.13.6|
During an nginx reload, workers perform a gracefully shutdown, closing listening and idle sockets and waiting for in progress messages to complete after which, those connections will be closed also; however, even nginx knows will immediately close the connection it still sends a "Connection: keep-alive" header.
RFC7230 states that "Connection: close" indicates that sender is going to close the connection after message is sent, which is exactly what nginx is going to do when shutting down; so sending Connection: close instead of Connection: keep-alive header seems to be a more polite behavior towards clients.
I do understand that sending "Connection: keep-alive" and closing connection afterwards is still in the RFC boundaries as detailed in: https://trac.nginx.org/nginx/ticket/1022; still, it would be nicer to send Connection: close when next behavior is 100% known. Note that this is about inflight messages only, and not about idle connections as 1022 case is focused on.
The "close" connection option is defined for a sender to signal that this connection will be closed after completion of the response. For example, Connection: close in either the request or the response header fields indicates that the sender is going to close the connection after the current request/response is complete (Section 6.6).
I would really appreciate your comments on this issue,