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 1091823 of Trailer

  • Revision slug: Web/HTTP/Headers/Trailer
  • Revision title: Trailer
  • Revision id: 1091823
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment

Revision Content

{{HTTPSidebar}}

The Trailer request header allows the sender to include additional fields at the end of chunked messages in order to supply metadata that might be dynamically generated while the message body is sent, such as a message integrity check, digital signature, or post-processing status.

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

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

Syntax

Trailer: header-names

Directives

header-names
HTTP header fields which will be present in the trailer part of chunked messages. These header fields are disallowed:
  • message framing headers (e.g., {{HTTPHeader("Transfer-Encoding")}} and {{HTTPHeader("Content-Length")}}),
  • routing headers (e.g., {{HTTPHeader("Host")}}),
  • request modifiers (e.g., controls and conditionals, like {{HTTPHeader("Cache-Control")}}, {{HTTPHeader("Max-Forwards")}}, or {{HTTPHeader("TE")}}), 
  • authentication headers (e.g., {{HTTPHeader("Authorization")}} or {{HTTPHeader("Set-Cookie")}}),
  • or {{HTTPHeader("Content-Encoding")}}, {{HTTPHeader("Content-Type")}}, {{HTTPHeader("Content-Range")}}, and Trailer itself.

Examples

Chunked transfer encoding using a trailer

HTTP/1.1 200 OK 
Content-Type: text/plain 
Transfer-Encoding: chunked
Trailer: Expires

7\r\n 
Mozilla\r\n 
9\r\n 
Developer\r\n 
7\r\n 
Network\r\n 
0\r\n 
\r\n
Expires: Wed, 21 Oct 2015 07:28:00 GMT

Specifications

Specification Title
{{RFC("7230", "Trailer", "4.4")}} Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing
{{RFC("7230", "Chunked trailer part", "4.1.2")}} Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing

Browser compatibility

{{Compat}}

See also

Revision Source

<div>{{HTTPSidebar}}</div>

<p>The <strong>Trailer</strong> request header allows the sender to include additional fields at the end of chunked messages in order to supply metadata that might be dynamically generated while the message body is sent, such as a message integrity check, digital signature, or post-processing status.</p>

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

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Header type</th>
   <td>{{Glossary("Response 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">
Trailer: header-names</pre>

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

<dl>
 <dt><code>header-names</code></dt>
 <dd>HTTP header fields which will be present in the trailer part of chunked messages. These header fields are <strong>disallowed</strong>:
 <ul>
  <li>message framing headers (e.g., {{HTTPHeader("Transfer-Encoding")}} and {{HTTPHeader("Content-Length")}}),</li>
  <li>routing headers (e.g., {{HTTPHeader("Host")}}),</li>
  <li>request modifiers (e.g., controls and conditionals, like {{HTTPHeader("Cache-Control")}}, {{HTTPHeader("Max-Forwards")}}, or {{HTTPHeader("TE")}}),&nbsp;</li>
  <li>authentication headers (e.g., {{HTTPHeader("Authorization")}} or {{HTTPHeader("Set-Cookie")}}),</li>
  <li>or {{HTTPHeader("Content-Encoding")}}, {{HTTPHeader("Content-Type")}}, {{HTTPHeader("Content-Range")}}, and <code>Trailer</code> itself.</li>
 </ul>
 </dd>
</dl>

<h2>Examples</h2>

<h3>Chunked transfer encoding using a trailer</h3>

<pre>
HTTP/1.1 200 OK 
Content-Type: text/plain 
Transfer-Encoding: chunked
Trailer: Expires

7\r\n 
Mozilla\r\n 
9\r\n 
Developer\r\n 
7\r\n 
Network\r\n 
0\r\n 
\r\n
Expires: Wed, 21 Oct 2015 07:28:00 GMT</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Title</th>
  </tr>
  <tr>
   <td>{{RFC("7230", "Trailer", "4.4")}}</td>
   <td>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</td>
  </tr>
  <tr>
   <td>{{RFC("7230", "Chunked trailer part", "4.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("Transfer-Encoding")}}</li>
 <li>{{HTTPHeader("TE")}}</li>
 <li>
  <p><a href="https://en.wikipedia.org/wiki/Chunked_transfer_encoding">Chunked transfer encoding</a></p>
 </li>
</ul>
Revert to this revision