Trailer

The Trailer header allows a method that the Web server or Web client can use in HTTP messages to include some HTTP headers after the content. Recall that an HTTP message is constructed as follows:

  • Request line (HTTP requests)/Status line (HTTP responses)

  • HTTP headers

  • Content

The use of the Trailer header allows for the following format to be used:

  • Request line (HTTP requests)/Status line (HTTP responses)

  • HTTP headers

  • Content

  • HTTP headers

This allocation is only allowed when a chunked transfer encoding is used, as is specified with the use of the following general header:

Transfer-Encoding: chunked 

The headers that are included after the content must be specified by name in the Trailer header. The following example shows an HTTP response ...

Get HTTP Developer’s Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.