The HTTP Keep-Alive header is used to specify parameters when the HTTP Connection header is set to
The Keep-Alive header is referenced only when the HTTP Connection header is set to
keep-alive. It includes parameters to govern the idle timeout and the maximum number of HTTP requests. There are two directives:
timeout directive refers to the number of seconds that the host will leave the HTTP Connection intact before closing it. In this context, an idle HTTP connection is one where no data is transmitted by either side for the specified period. The host can optionally leave the HTTP connection open for longer than the specified number of seconds.
max directive specifies the maximum number of HTTP requests that can be processed on the HTTP Connection before it is closed. This directive is ignored for non-pipelined HTTP connections unless the value is
0, as it is intended for an HTTP pipeline to limit pipelining.
max=<maximum # of requests>
In this example, the idle timeout is set to ten seconds and it can accept up to 100 HTTP requests before the HTTP Connection is forcibly closed.
HTTP/1.1 200 OK Connection: keep-alive Content-Type: text/html; chartset=utf-8 Keep-Alive: timeout=10, max=100
The Keep-Alive header is used to supply relevant HTTP connection-related parameters when the HTTP Connection header is present.