-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
96 lines (75 loc) · 2.28 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
title: Trailer
slug: Web/HTTP/Headers/Trailer
page-type: http-header
browser-compat: http.headers.Trailer
---
{{HTTPSidebar}}
The **Trailer** 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, such as a message integrity check,
digital signature, or post-processing status.
> [!NOTE]
> The {{HTTPHeader("TE")}} request header needs to be set to "trailers" to allow
> trailer fields.
<table class="properties">
<tbody>
<tr>
<th scope="row">Header type</th>
<td>
{{Glossary("Request header")}},
{{Glossary("Response header")}},
{{Glossary("Payload header")}}
</td>
</tr>
<tr>
<th scope="row">{{Glossary("Forbidden header name")}}</th>
<td>yes</td>
</tr>
</tbody>
</table>
## Syntax
```http
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 trailing header
In this example, the {{HTTPHeader("Expires")}} header is used at the end of the chunked
message and serves as a trailing header.
```http
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
Expires: Wed, 21 Oct 2015 07:28:00 GMT\r\n
\r\n
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{HTTPHeader("Transfer-Encoding")}}
- {{HTTPHeader("TE")}}
- [Chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding)