From 511b7b3d4743636de9d9fbe8ff409730d221d273 Mon Sep 17 00:00:00 2001 From: Domi Date: Sat, 31 May 2014 17:35:30 +0800 Subject: [PATCH] Fix proxy path This fix considers the actual target path again (which has been ignored). --- lib/http-proxy/common.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/http-proxy/common.js b/lib/http-proxy/common.js index 5d10647..9de052e 100644 --- a/lib/http-proxy/common.js +++ b/lib/http-proxy/common.js @@ -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; + // // 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;