From 739a64ffb50918bd435f52a08a797da147a23510 Mon Sep 17 00:00:00 2001 From: IdeaHunter Date: Wed, 1 Feb 2017 00:02:29 +0300 Subject: [PATCH] Fix incorrect target name for reverse proxy example --- examples/http/reverse-proxy.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/http/reverse-proxy.js b/examples/http/reverse-proxy.js index 1e80d4e93..933d36f80 100644 --- a/examples/http/reverse-proxy.js +++ b/examples/http/reverse-proxy.js @@ -31,8 +31,9 @@ var proxy = httpProxy.createServer(); var server = http.createServer(function (req, res) { util.puts('Receiving reverse proxy request for:' + req.url); - - proxy.web(req, res, {target: req.url, secure: false}); + var parsedUrl = url.parse(req.url); + var target = parsedUrl.protocol + '//' + parsedUrl.hostname; + proxy.web(req, res, {target: target, secure: false}); }).listen(8213); server.on('connect', function (req, socket) {