Skip to content

Commit 42d75ff

Browse files
author
Nikita
committed
Added trailer header support for http/2
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 1409bae commit 42d75ff

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/proxy.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,11 @@ export class Proxy implements IProxy {
10521052
return self._onError("ON_RESPONSE_ERROR", ctx, err);
10531053
}
10541054
const servToProxyResp = ctx.serverToProxyResponse!;
1055+
1056+
if (servToProxyResp.headers["trailer"]) {
1057+
servToProxyResp.headers["transfer-encoding"] = "chunked";
1058+
}
1059+
10551060
if (
10561061
self.responseContentPotentiallyModified ||
10571062
ctx.responseContentPotentiallyModified

0 commit comments

Comments
 (0)