Skip to content

Commit 244303b

Browse files
IdeaHunterindexzero
authored andcommitted
Fix incorrect target name for reverse proxy example (#1135)
1 parent b4028ba commit 244303b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/http/reverse-proxy.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ var proxy = httpProxy.createServer();
3131

3232
var server = http.createServer(function (req, res) {
3333
util.puts('Receiving reverse proxy request for:' + req.url);
34-
35-
proxy.web(req, res, {target: req.url, secure: false});
34+
var parsedUrl = url.parse(req.url);
35+
var target = parsedUrl.protocol + '//' + parsedUrl.hostname;
36+
proxy.web(req, res, {target: target, secure: false});
3637
}).listen(8213);
3738

3839
server.on('connect', function (req, socket) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy