An HTTP persistent connection, often called keep-alive, is a connection that stays open after a response so the next request can use it. Without it, every file would need a fresh connection.
That matters because opening a connection costs time. The browser and server first exchange several messages over TCP, and for HTTPS they also set up encryption. A connection that's been in use for a while also sends data faster than a new one, because TCP speeds up gradually. Say a page loads 40 files: without reuse, it would pay that price 40 times.
How it works in each HTTP version
| Version | Default | How it's controlled |
|---|---|---|
| HTTP/1.0 | Closed after each response | Both sides send Connection: keep-alive to keep it open |
| HTTP/1.1 | Stays open | Either side sends Connection: close to end it |
| HTTP/2 and HTTP/3 | One long-lived connection per site | Built into the protocol; Connection and Keep-Alive headers are forbidden |
In HTTP/1.1, persistence is the default, so you don't need to switch anything on. RFC 9112 You'll still often see Connection: keep-alive in headers, added as a fallback for HTTP/1.0.
Why browsers still open several connections
An HTTP/1.1 connection handles one request at a time: the next request waits until the current response has arrived. The standard allows pipelining, sending several requests without waiting, but no modern browser turns it on by default, because many proxies and servers handle it badly.
So browsers open several connections in parallel. Chrome opens up to six per site over HTTP/1.1 and queues the rest. Chrome DevTools
HTTP/2 removes this limit by sending many requests at once over a single connection. With HTTP/2, one persistent connection does the work of six.
Server settings: timeout and request limit
A server doesn't keep idle connections open forever, because each one holds memory. Two settings decide how long and how much:
| Setting | Apache default | nginx default |
|---|---|---|
| How long an idle connection stays open | KeepAliveTimeout 5 (seconds) |
keepalive_timeout 75s |
| Requests allowed on one connection | MaxKeepAliveRequests 100 |
keepalive_requests 1000 |
The trade-off: a longer timeout saves reconnects for visitors who click on to the next page, but ties up resources on a busy server. A shorter one frees resources but means more new connections. The HTTP standard sets no required length, so start with your server's default and change it only when your monitoring shows a reason.
Servers can tell clients their limits in a header such as Keep-Alive: timeout=5, max=200.
Keep-alive works hop by hop. If you use a CDN or a proxy server, the visitor's browser keeps a connection open to the CDN, and the CDN manages its own connections to your server.
A pitfall when you move to HTTP/2
Connection and Keep-Alive headers are forbidden in HTTP/2 and HTTP/3. Chrome and Firefox ignore them. Safari refuses to load a response that contains them. MDN If a page breaks only in Safari after an upgrade, check whether your app or a server rule adds these headers.
Check whether connections are reused
In Chrome's developer tools, open the Network tab, right-click a column header and add Connection ID. Requests with the same ID shared a connection. Click a request and open Timing: an "Initial connection" step means the browser had to open a new connection for it.
Persistent connections and SEO
Nothing in Google's documentation ties connection reuse to rankings. What it does: pages load faster for visitors, and crawling gets cheaper. When Google started crawling over HTTP/2, it explained that fewer open connections mean fewer resources spent by your server and by Googlebot. See page speed for the other factors that decide load time.