Spec-Zone.ru › HTTP

Headers: Connection

Connection header

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

  • Learn more
  • See full compatibility
>

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 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.

All hop-by-hop headers, including the standard hop-by-hop headers (Keep-Alive, Transfer-Encoding, TE, Connection, Trailer, Upgrade, Proxy-Authorization, and 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.

Header type Request header, Response header
Forbidden request header Yes

Syntax

Connection: keep-alive
Connection: close

Directives

close

Indicates that either the client or the server would like to close the connection. This is the default on HTTP/1.0 requests.

any comma-separated list of HTTP headers (usually keep-alive only)

Indicates that the client would like to keep the connection open. Keeping a connection open is the default on HTTP/1.1 requests. The list of headers are the name of the header to be removed by the first non-transparent proxy or cache in-between: these headers define the connection between the emitter and the first entity, not the destination node.

Specifications

Specification
HTTP Semantics>
# field.connection>

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
Connection 1 12 1 15 1 18 4 14 1 1.0 4.4 1

See also

  • Connection management in HTTP/1.x
  • Protocol upgrade mechanism

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Connection

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API