Skip to content

Commit

Permalink
[fix] set connection to CLOSE in cases where the agent is false.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrugzz committed Mar 27, 2014
1 parent a7b16eb commit 89a22bc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/http-proxy/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?
//
Expand Down

2 comments on commit 89a22bc

@xfournet
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing connection on every proxied request has a big impact on performance. Nowadays, is it still required to force the connection close for each request ?

@lispc
Copy link

@lispc lispc commented on 89a22bc Dec 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here.

Please sign in to comment.