Connection Header
Table of Content
The Connection header has an essential role in controlling network protocol parameters in HTTP/1.1. It acts as a general directive for network connections and its properties. The header can manifest directives to either close the connection after the current request-response pair or to keep it open for further requests.
Syntax
Connection: <directive>
Directives
There are two primary directives related to the Connection header: Keep-Alive
and close
.
Keep-Alive
: This directive signals that the connection should stay active for further HTTP requests.close
: This directive requires the network connection to terminate after the current transaction completes.
Examples
Example using the Keep-Alive
directive:
Connection: Keep-Alive
Example using the close
directive:
Connection: close
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Supported |
Safari | Supported |
Opera | Supported |
Edge | Supported |
How to modify Connection header
ModHeader is an extension that enables users to customize HTTP request headers, which includes the Connection header. After installing the extension, you can add or modify headers by following these steps:
- Click on ModHeader in the toolbar of your Chrome browser.
- In the newly opened pop-up window, you see two input fields. The left one is for the header's name, enter "Connection" in the left field.
- In the right field, you should specify the directive you want to use, such as 'Keep-Alive' or 'close'.
- After setting up, the extension will automatically apply the header to all outgoing requests. This manipulation allows custom testing and potentially could enhance your browsing by using the persistent connectivity provided by the 'Keep-Alive' directive or freeing up the resource as soon as possible through the 'close' directive.