Skip to content

Fixes content from the response from node.js being cut off #655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions lib/http-proxy/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,20 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
outgoing.localAddress = options.localAddress;

//
// Remark: If we are false and not upgrading, set the connection: close. This is the right thing to do
// as node core doesn't handle this COMPLETELY properly yet.
// Remark: agent string set to false can break proxies response from node
//
if (!outgoing.agent) {
outgoing.headers = outgoing.headers || {};
if (typeof outgoing.headers.connection !== 'string'
|| outgoing.headers.connection.toLowerCase() !== 'upgrade'
) { outgoing.headers.connection = 'close'; }
}

if (outgoing.agent === false)
delete outgoing.agent;
//
// Remark: HTTP/1.1 spec says:
// The Connection general-header field allows the sender to specify options
// that are desired for that particular connection and MUST NOT be
// communicated by proxies over further connections.
// See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
//
if (outgoing.headers && outgoing.headers.connection == "close")
delete outgoing.headers.connection;

//
// Remark: Can we somehow not use url.parse as a perf optimization?
//
Expand Down