Skip to content

Commit

Permalink
Fix incorrect target name for reverse proxy example (#1135)
Browse files Browse the repository at this point in the history
  • Loading branch information
IdeaHunter authored and indexzero committed Aug 22, 2019
1 parent b4028ba commit 244303b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/http/reverse-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 244303b

Please sign in to comment.