File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -52,15 +52,20 @@ see the [demo](http://github.com/nodejitsu/node-http-proxy/blob/master/demo.js)
52
52
httpProxy = require('http-proxy');
53
53
54
54
httpProxy.createServer(function (req, res, proxy) {
55
- //
56
55
// Put your custom server logic here
57
- //
58
56
proxy.proxyRequest('localhost', '9000', req, res);
59
57
}).listen(8000);
60
58
59
+ http.createServer(function (req, res){
60
+ var proxy = new httpProxy.HttpProxy;
61
+ proxy.watch(req, res);
62
+ // Put your custom server logic here
63
+ proxy.proxyRequest('localhost', 9000, req, res);
64
+ }).listen(8001);
65
+
61
66
http.createServer(function (req, res){
62
67
res.writeHead(200, {'Content-Type': 'text/plain'});
63
- res.write('request successfully proxied! ' + '\n' + JSON.stringify(req.headers, true, 2));
68
+ res.write('request successfully proxied: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
64
69
res.end();
65
70
}).listen(9000);
66
71
You can’t perform that action at this time.
0 commit comments