Skip to content

Fix proxy path #645

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

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 5 additions & 1 deletion lib/http-proxy/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
) { outgoing.headers.connection = 'close'; }
}


// the final path is target path + relative path requested by user:
outgoing.path = options.target.path;

Choose a reason for hiding this comment

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

Is this better fit as written like below? This matches the convention used throughout the setupOutgoing method.

outgoing.path =  options[forward || 'target'].path;

This could also be expanded to be written as below. This would likely satisfy the integration testing.

outgoing.path =  options[forward || 'target'].path || '';

If we don't like the idea of setting outgoing.path as an empty string this could easily be rewritten to be wrapped in some conditionals.


//
// Remark: Can we somehow not use url.parse as a perf optimization?
//
outgoing.path = !options.toProxy
outgoing.path += !options.toProxy
? url.parse(req.url).path
: req.url;

Expand Down