Skip to content

Commit 128580a

Browse files
authored
Added trailer header support for http/2 (#303)
The basic node.js http library uses http/1, so you have to specify 'transfer-encoding: chunked' for requests that include trailers. In http/2 there is no need to specify this header and most sites have stopped doing it. As a result, when the headers are parsed, our server cannot find the header 'transfer-encoding: chunked' and causes an error
1 parent ad79ddc commit 128580a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/proxy.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,11 @@ export class Proxy implements IProxy {
10601060
return self._onError("ON_RESPONSE_ERROR", ctx, err);
10611061
}
10621062
const servToProxyResp = ctx.serverToProxyResponse!;
1063+
1064+
if (servToProxyResp.headers["trailer"]) {
1065+
servToProxyResp.headers["transfer-encoding"] = "chunked";
1066+
}
1067+
10631068
if (
10641069
self.responseContentPotentiallyModified ||
10651070
ctx.responseContentPotentiallyModified

0 commit comments

Comments
 (0)