Can't set headers after they are sent
Created by: xolf
I just got a very strange error. The proxy tries to send the header twice and I have no idea why.
_http_outgoing.js:335
throw new Error('Can\'t set headers after they are sent.');
^
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:335:11)
at g:\nodejs\http-proxy\node_modules\http-proxy\lib\http-proxy\passes\web-outgoing.js:85:11
at Array.forEach (native)
at Array.writeHeaders (g:\nodejs\http-proxy\node_modules\http-proxy\lib\http-proxy\passes\web-outgoing.js:84:35)
at ClientRequest.<anonymous> (g:\nodejs\http-proxy\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:151:20)
at ClientRequest.emit (events.js:107:17)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:419:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:111:23)
at Socket.socketOnData (_http_client.js:310:20)
at Socket.emit (events.js:107:17)
My proxy.js
file: https://gist.github.com/xolf/f79a1f939d7dc64c9894