HTTP headers | Connection Last Updated : 07 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The HTTP Connection header is a general type header that allows the sender or client to specify options that are desired for that particular connection. Instead of opening a new connection for every single request/response, Connection helps in sending or receiving multiple HTTP requests/responses using a single TCP connection. It also controls whether or not the network stays open or close after the current transaction finishes. Syntax: Connection: keep-alive Connection: close Directives: This HTTP Connection header accept two directives mentioned above and described below: keep-alive This directive indicates that the client wants to keep the connection open or alive after sending the response message. In HTTP 1.1 version, by default uses a persistent connection where it doesn't close automatically after a transaction. But the HTTP 1.0 will not consider the connections as persistent, so if you want to keep it alive, you need to include a keep-alive connection header. close This close connection directive indicates that the client wants to close the connection after sending the response message. In HTTP 1.0, by default, the connection gets closed. But in HTTP 1.1, you need to include it in the header if you want your connection to close. Note: Both the directives are also headers that represent the connection in combine. Example: Here, in the below example, the connection is keep-alive (i.e) the client wants to keep it open and the value is 100. Usually, the value 100 is sufficient for almost every scenario. However, you can increase it depending on the number of files the server needs to deliver within the web page. Keep-Alive: 100 Connection: keep-alive The below example is the request message sent by a client in which it wants the connection to close after the response message is delivered. Connection: close To check this Connection in action go to Inspect Element -> Network check the header for Connection like below. Browser Compatibility: The browsers are compatible with HTTP Connection header are listed below: Google Chrome Internet Explorer Edge Firefox Safari Opera Comment More infoAdvertise with us Next Article HTTP headers | Connection S sowmyarajucherukuri Follow Improve Article Tags : Computer Networks HTTP-headers Similar Reads HTTP headers | Forwarded HTTP headers allow client and server to pass supplementary information with an HTTP request or HTTP response. Headers can be classified according to their context. General headers contain information about both request and response but no relation with the data being transmitted. Request headers con 2 min read HTTP headers | Alt-Svc The HTTP headers Alt-Svc header is a response-type header it has been used to advertise alternative service. Which services can be defined by a protocol/host/port combination. Syntax: Alt-Svc: clear Alt-Svc: <protocol-id>=<alt-authority>; ma=<max-age>; persist=1 Directives: This he 1 min read HTTP headers | Keep-Alive The Keep-Alive header is a general-type header. This header is used to hint at how the connection may be used to set a timeout and a maximum amount of requests. It can also be used to allow a single TCP connection to remain open for multiple HTTP requests/responses (default HTTP connection closed af 2 min read Connection-less Service A Connectionless Service is technique that is used in data communications to send or transfer data or message at Layer 4 i.e., Transport Layer of Open System Interconnection model. This service does not require session connection among sender or source and receiver or destination. Sender starts tran 3 min read HTTP headers | Early-Data The Early-Data header is a kind of HTTP header that permits clients to send requests immediately. This ensures that there are no one or two round-trip delays that are required by Transport Layer Security (TLS) handshake to get executed. When this header is set, it indicates that the request has been 1 min read Like