HTTP trailers provide a way to send some additional fields after request’s/response’s body. They are typically used by systems like gRPC to send some additional metadata, but are useful in other contexts. For example, your app may compute a checksum over some streaming body and share it with the client once the body is fully sent. Or you could be streaming an LLM response and send the number of tokens it consumed in a trailer.
fly-proxy has supported HTTP trailers for HTTP/2 apps for a while, but this required the apps to use h2_backend HTTP option, as all requests are “downgraded” to HTTP/1.1 on the last hop by default.
We have just added support for trailers for HTTP/1.1 requests, so even if your app speaks only HTTP/1.1 the trailers should now work.
Trailers in both requests and responses are supported.
Keep in mind that if a client makes an actual HTTP/1.1 request to your app (and not an HTTP/2 request that gets “downgraded” to HTTP/1.1 by the proxy on the last hop) and expects your app to send back some trailers, it needs to set TE: trailer header to indicate that. Otherwise fly-proxy won’t forward response trailers.
While working on this we’ve also fixed trailers with encoded bodies. We used to silently drop all trailers after encoding a body with zstd/gzip/etc. This should now be fixed.