files/en-us/web/http/reference/headers/keep-alive/index.md
The HTTP Keep-Alive {{Glossary("request header", "request")}} and {{Glossary("response header")}} allows the sender to hint how a connection may be used in terms of a timeout and a maximum amount of requests.
[!NOTE] For
Keep-Aliveto have any effect, the message must also include a {{HTTPHeader("Connection", "Connection: keep-alive")}} header.
HTTP/1.0 closes the connection after each request/response interaction by default, so persistent connections in HTTP/1.0 must be explicitly negotiated.
Some clients and servers might wish to be compatible with previous approaches to persistent connections, and can do this with a Connection: keep-alive request header.
Additional parameters for the connection can be requested with the Keep-Alive header.
<table class="properties"> <tbody> <tr> <th scope="row">Header type</th> <td> {{Glossary("Request header")}}, {{Glossary("Response header")}} </td> </tr> <tr> <th scope="row">{{Glossary("Forbidden request header")}}</th> <td>Yes</td> </tr> </tbody> </table>[!WARNING] Connection-specific header fields such as {{HTTPHeader("Connection")}} and
Keep-Aliveare prohibited in HTTP/2 and HTTP/3. Chrome and Firefox ignore them in HTTP/2 responses, but Safari conforms to the HTTP/2 specification requirements and does not load any response that contains them.
Keep-Alive: <parameters>
<parameters>
=).
The following identifiers are possible:
timeout
timeout seconds, but the host should attempt to retain a connection for at least timeout seconds.max
0, this value is ignored for non-pipelined connections as another request will be sent in the next response.
An HTTP pipeline can use it to limit the pipelining.A response containing a Keep-Alive header:
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Date: Thu, 11 Aug 2016 15:23:13 GMT
Keep-Alive: timeout=5, max=200
Last-Modified: Mon, 25 Jul 2016 04:32:39 GMT
Server: Apache
(body)
{{Specifications}}
{{Compat}}