Spec-Zone.ru › HTTP

Headers: Trailer

Trailer header

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

  • Learn more
  • See full compatibility
>

The HTTP Trailer request and response 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.

Note: The TE request header needs to be set to trailers to allow trailer fields.

Warning: Developers cannot access HTTP trailers via the Fetch API or XHR. Additionally, browsers ignore HTTP trailers, with the exception of Server-Timing. See Browser compatibility for more information.

Header type Request header, Response header, Content header
Forbidden request header Yes

Syntax

Trailer: header-names

Directives

header-names

HTTP header fields which will be present in the trailer part of chunked messages. The following header names are disallowed:

  • Content-Encoding, Content-Type, Content-Range, and Trailer
  • Authentication headers (e.g., Authorization or Set-Cookie)
  • Message framing headers (e.g., Transfer-Encoding and Content-Length)
  • Routing headers (e.g., Host)
  • Request modifiers (e.g., controls and conditionals, like Cache-Control, Max-Forwards, or TE)

Examples

>

Server-Timing as HTTP trailer

Some browsers support showing server timing data in developer tools when the Server-Timing header is sent as a trailer. In the following response, the Trailer header is used to indicate that a Server-Timing header will follow the response body. A metric custom-metric with a duration of 123.4 milliseconds is sent:

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Trailer: Server-Timing

--- response body ---
Server-Timing: custom-metric;dur=123.4

Specifications

Specification
HTTP Semantics>
# field.trailer>
HTTP/1.1>
# chunked.trailer.section>

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
Trailer No No
71Only the Server-Timing header is a recognized trailer, and it is only exposed to DevTools in the network Timing tab (bug 1403051). Developers cannot access trailers via the Fetch API or XHR.
No No No
79Only the Server-Timing header is a recognized trailer, and it is only exposed to DevTools in the network Timing tab (bug 1403051). Developers cannot access trailers via the Fetch API or XHR.
No No No No No

See also

  • Server-Timing
  • Transfer-Encoding
  • TE
  • Chunked transfer encoding

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Trailer

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API