files/en-us/web/http/reference/headers/connection/index.md
The HTTP Connection 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 subsequent requests to the same server on the same connection.
[!WARNING] Connection-specific header fields such as
Connectionand {{HTTPHeader("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.
All hop-by-hop headers, including the standard hop-by-hop headers ({{HTTPHeader("Keep-Alive")}}, {{HTTPHeader("Transfer-Encoding")}}, {{HTTPHeader("TE")}}, Connection, {{HTTPHeader("Trailer")}}, {{HTTPHeader("Upgrade")}}, {{HTTPHeader("Proxy-Authorization")}}, and {{HTTPHeader("Proxy-Authenticate")}}) must be listed in the Connection header, so that the first proxy knows it has to consume them and not forward them further.
The default value of Connection changed between HTTP/1.0 and HTTP/1.1.
Therefore, to ensure backwards compatibility, browsers often send Connection: keep-alive explicitly, even though it's the default in HTTP/1.1.
Connection: keep-alive
Connection: close
close
keep-alive only)
{{Specifications}}
{{Compat}}