var express = require(‘express’); var router = express.Router(); var httpProxy = require(‘http-proxy’);
//新建一个代理Proxy server 对象 var proxy = httpProxy.createProxyServer({});
proxy.on(‘proxyReq’, function (proxyReq, req, res, options) { proxyReq.body = req.body; console.log("-----proxyReq--------"); });
router.post(’/gcl/vri/versionScan’, function (req, res, next) { console.log(req.body.name); console.log(req.body.password); console.log("----/gcl/vri/versionScan–"); proxy.web(req, res, {target: ’http://192.168.11.150:8161'}); });
做过这方面的麻烦看看,特急!!!