Node.js的HTTP代理:node-http-proxy

jopen 6年前

node-http-proxy是一个用于Node.js的HTTP可编程代理库,支持 websockets。它是适用于实现例如代理服务器和负载均衡这样的组件。
Node.js的HTTP代理:node-http-proxy

var http = require('http'),      httpProxy = require('http-proxy');  //  // Create your proxy server and set the target in the options.  //  httpProxy.createProxyServer({target:'http://localhost:9000'}).listen(8000);    //  // Create your target server  //  http.createServer(function (req, res) {    res.writeHead(200, { 'Content-Type': 'text/plain' });    res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));    res.end();  }).listen(9000);

项目主页:http://www.open-open.com/lib/view/home/1402821332075