Adding support for HTTP trailing headers in chunked requests

Piotr Sikora piotrsikora at
Fri May 27 20:29:55 UTC 2016

Hey Wesley,

> Are there any plans to support HTTP trailing headers in chunked requests as per

Coincidentally, I've started looking into adding support for HTTP
trailers yesterday.

Also, you're referencing obsolete RFC, RFC7230 is the one you want.

> If not, we would be interested in sending a patch for adding support. It looks like we would modify ngx_http_parse_chunked and refactor ngx_http_parse_header_line so we can reuse it for parsing trailing headers. And then have a directive to whitelist which trailing headers to allow.

It seems that you're only considering sending HTTP/1.1 requests with
trailers, not responses, is that correct?

Out of curiosity, what's the use case?

> When the request is proxied upstream, if it’s fully buffered we could add the trailing header as a request header. If it’s unbuffered, then just proxy them as trailing headers.

Sounds reasonable, except that implementing such behavior means that
for the same client request with trailers, depending on the buffering
setting, upstream could receive two very different request from NGINX,
which is quite confusing... and considering that recipient is allowed
to ignore trailers, it means that depending on the buffering setting,
other intermediate proxies and/or runtimes, headers received by the
recipient could be different.

Also, what about the case in which request arrives with "Connection:
TE"? Would you enforce buffering or drop the trailers?

> And we would only include the whitelisted headers.

There is no whitelist for regular headers, why do you want to limit
headers sent in trailers? Especially if you want to convert them into
regular headers with buffering enabled.

Best regards,
Piotr Sikora

More information about the nginx-devel mailing list