node-http-mitm-proxy
node-http-mitm-proxy copied to clipboard
ERR_HTTP_TRAILER_INVALID
Line 1074 is throwing this error when certain websites are accessed. I was able to finally see that it was this line by adding a try catch block around it so the proxy program I was using could log it otherwise an uncaughtException would occur and make it hard to debug. I propose the simple try catch block around this section to capture this error.

try {
ctx.proxyToClientResponse.writeHead(ctx.serverToProxyResponse.statusCode, Proxy.filterAndCanonizeHeaders(ctx.serverToProxyResponse.headers));
ctx.responseFilters.push(new ProxyFinalResponseFilter(self, ctx));
var prevResponsePipeElem = ctx.serverToProxyResponse;
ctx.responseFilters.forEach(function(filter) {
filter.on('error', self._onError.bind(self, 'RESPONSE_FILTER_ERROR', ctx));
prevResponsePipeElem = prevResponsePipeElem.pipe(filter);
});
} catch (e) {
return self._onError('ON_RESPONSEHEADERS_ERROR_WRITE',ctx,e);
}
Line 836 was prior to some formatting changes I believe.