The Connection
general header controls whether the network connection stays open after the current transaction finishes. If the value sent is keep-alive
, the connection is persistent and not closed, allowing for subsequent requests to the same server to be done.
Warning: Connection-specific header fields such as Connection
and Keep-Alive
are prohibited in HTTP/2 and HTTP/3. Chrome and Firefox ignore them in HTTP/2 responses, but Safari conforms to the HTTP/2 spec requirements and does not load any response that contains them.
Except for the standard hop-by-hop headers (Keep-Alive
, Transfer-Encoding
, TE
, Connection
, Trailer
, Upgrade
, Proxy-Authorization
and Proxy-Authenticate
), any hop-by-hop headers used by the message must be listed in the Connection
header, so that the first proxy knows it has to consume them and not forward them further. Standard hop-by-hop headers are also required to be listed.
Header type | Request header, Response header |
---|---|
Forbidden header name | yes |