Avoid error Uncaught Error: Can't set headers after they are sent.
Created by: abarre
In this portion of the code : https://github.com/nodejitsu/node-http-proxy/blob/master/lib/http-proxy/passes/web-incoming.js#L148...L157, there is no verification if the headers of the response have already been sent to the client. It happens in my case when an error is fired and after I return an error 500 to the client.
Fix :
This portion of code can be wrapped by if(!res.finished){}
to prevent the exception Uncaught Error: Can't set headers after they are sent.
.