DevKits

Miscellaneous · Request & Response

Connection

Controls whether the network connection stays open after the current transaction.

What is Connection?

Historically toggled keep-alive vs close. Also used in tandem with Upgrade for protocol switches (`Connection: Upgrade`). HTTP/2 removed hop-by-hop headers and made Connection irrelevant there.

Typical usage

Rarely set manually. Automatic in HTTP/1.1 keep-alive.

Examples

Connection: keep-alive
Connection: Upgrade

Specification

RFC 9110 §7.6.1

Frequently asked questions

What is the Connection HTTP header?

Historically toggled keep-alive vs close. Also used in tandem with Upgrade for protocol switches (`Connection: Upgrade`). HTTP/2 removed hop-by-hop headers and made Connection irrelevant there.

Is Connection a request or response header?

Connection can appear on both requests and responses. Rarely set manually. Automatic in HTTP/1.1 keep-alive.

What does a Connection header look like?

A typical Connection header looks like: Connection: keep-alive.

Related headers

Work with this header