Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1104141 of Keep-Alive

  • Revision slug: Web/HTTP/Headers/Keep-Alive
  • Revision title: Keep-Alive
  • Revision id: 1104141
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{HTTPSidebar}}{{Non-standard_header}}

The Keep-Alive general header allows the sender to hint about how the connection may be used by setting a timeout and a max amount of requests.

The {{HTTPHeader("TE")}} request header needs to be set to "trailers" to allow trailer fields.

Header type {{Glossary("General header")}}
{{Glossary("Forbidden header name")}} no

Syntax

Keep-Alive: parameters

Directives

  • timeout hinting about the time the connection has to be kept open (in seconds). Note that timeout longer than the TCP timeout may be ignored if no keep-alive TCP message is set at the transport level.
  • max indicating the max amount of requests that can be send on this connection before closing it. Unless 0, this value is ignored for non-pipelined connection as another request will be send in the next response. HTTP pipeline can use it to limit the amount of pipelining done.
parameters
A comma-separated list of parameters, each consisting in a identifer and a value separated by the equal sign ('='). The following identifier are possible:

Examples

 

Specifications

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

Browser compatibility

{{Compat}}

See also

Revision Source

<div>{{HTTPSidebar}}{{Non-standard_header}}</div>

<p>The <strong>Keep-Alive</strong> general header allows the sender to hint about how the connection may be used by setting a timeout and a max amount of requests.</p>

<div class="note">
<p>The {{HTTPHeader("TE")}} request header needs to be set to "trailers" to allow trailer fields.</p>
</div>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Header type</th>
   <td>{{Glossary("General header")}}</td>
  </tr>
  <tr>
   <th scope="row">{{Glossary("Forbidden header name")}}</th>
   <td>no</td>
  </tr>
 </tbody>
</table>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">
Keep-Alive: <em>parameters</em></pre>

<h2 id="Directives">Directives</h2>

<ul>
 <li><code>timeout</code> hinting about the time the connection has to be kept open (in seconds). Note that timeout longer than the TCP timeout may be ignored if no keep-alive TCP message is set at the transport level.</li>
 <li><code>max</code> indicating the max amount of requests that can be send on this connection before closing it. Unless <code>0</code>, this value is ignored for non-pipelined connection as another request will be send in the next response. HTTP pipeline can use it to limit the amount of pipelining done.</li>
</ul>

<dl>
 <dt><em>parameters</em></dt>
 <dd>A comma-separated list of parameters, each consisting in a identifer and a value separated by the equal sign (<code>'='</code>). The following identifier are possible:</dd>
</dl>

<h2 id="Examples">Examples</h2>

<p>&nbsp;
 <h2 id="Specifications">Specifications</h2>
</p>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Title</th>
  </tr>
  <tr>
   <td><a href="https://tools.ietf.org/id/draft-thomson-hybi-http-timeout-01.html#rfc.section.2">HyperText Transport Protocol Keep-Alive Header</a></td>
   <td>The Keep-Alive Header (Experimental specification)</td>
  </tr>
  <tr>
   <td>{{RFC("7230", "Keep-Alive", "appendix-A.1.2")}}</td>
   <td>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p class="hidden">The compatibility table in this page is generated from structured data. If you’d like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data/README.md">https://github.com/mdn/browser-compat-data/README.md</a> and send us a pull request</p>

<p>{{Compat}}</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{HTTPHeader("Connection")}}</li>
 <li><a href="/en-US/docs/Web/HTTP/Connection_management_in_HTTP_1.x">Connection management in HTTP/1.x</a></li>
</ul>
Revert to this revision