diff --git a/lib/http-proxy/common.js b/lib/http-proxy/common.js index 1c838c931..51df1380e 100644 --- a/lib/http-proxy/common.js +++ b/lib/http-proxy/common.js @@ -45,6 +45,15 @@ common.setupOutgoing = function(outgoing, options, req, forward) { outgoing.agent = options.agent || false; + // + // Remark: If we are false set the connection: close. This is the right thing to do + // as node core doesn't handle this COMPLETELY properly yet. + // + if(!outgoing.agent) { + outgoing.headers = outgoing.headers || {}; + outgoing.headers.connection = 'close'; + } + // // Remark: Can we somehow not use url.parse as a perf optimization? //