--- title: Keep-Alive slug: Web/HTTP/Headers/Keep-Alive translation_of: Web/HTTP/Headers/Keep-Alive ---
{{HTTPSidebar}}

O cabeçalho Keep-Alive permite que o remetente indique como a conexão deve ser usada, para definir um tempo limite e um máximo de requisições.

O {{HTTPHeader("Connection")}} cabeçalho precisa ser definido como "keep-alive" para isso funcionar , {{HTTPHeader("Connection")}} e {{HTTPHeader("Keep-Alive")}} são ignorados em conexões HTTP/2; Gerenciamento de conexões são feitos por outros mecanismos.

Tipo de cabeçalho {{Glossary("General header")}}
{{Glossary("Forbidden header name")}} sim

Sintaxe

Keep-Alive: parametros

Diretivas

parâmetros
Uma vírgula separa a lista de parâmetros, Cada consiste de um identificador e um valor separado pelo sinal de igualdade ('='). São possíveis os seguintes identificadores:

Exemplos

Uma resposta content o cabeçalho Keep-Alive:

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=1000
Last-Modified: Mon, 25 Jul 2016 04:32:39 GMT
Server: Apache

(body)

Especificações

Specification Title
HyperText Transport Protocol Keep-Alive Header The Keep-Alive Header (Experimental specification)
RFC 7230, appendix A.1.2: Keep-Alive Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing

Compatibilidade dos navegadores

{{Compat("http.headers.Keep-Alive")}}

Veja também