Several pass-through paths, including ProxyUpstream and ProxyFile, copy every upstream header to the downstream response and discard the error from io.Copy. Protocol handlers contain similar response-copy blocks.
This leaves three protocol cases inconsistent:
- Headers named by
Connection, plus the standard hop-by-hop headers, can be forwarded downstream.
- Upstream trailers are not declared and copied to the downstream response.
- A chunked upstream response that ends early can be emitted as a cleanly terminated downstream response because the copy error does not abort the response.
A shared response relay helper could strip hop-by-hop headers, declare and copy trailers, respect HEAD and bodiless statuses, and abort the downstream response after a post-header copy failure. Copy failures should record the upstream URL, status, and byte count.
A route-level test can use an httptest upstream which returns a connection-scoped header, a trailer, and a truncated chunked body, then make a real client request through the proxy.
Observed on v0.8.1 and current main at 94c11b4.
Several pass-through paths, including
ProxyUpstreamandProxyFile, copy every upstream header to the downstream response and discard the error fromio.Copy. Protocol handlers contain similar response-copy blocks.This leaves three protocol cases inconsistent:
Connection, plus the standard hop-by-hop headers, can be forwarded downstream.A shared response relay helper could strip hop-by-hop headers, declare and copy trailers, respect
HEADand bodiless statuses, and abort the downstream response after a post-header copy failure. Copy failures should record the upstream URL, status, and byte count.A route-level test can use an
httptestupstream which returns a connection-scoped header, a trailer, and a truncated chunked body, then make a real client request through the proxy.Observed on v0.8.1 and current main at
94c11b4.