index.js 387 B

12345678910111213141516171819202122232425262728
  1. var http = require('http');
  2. var httpProxy = require('http-proxy');
  3. var proxy = httpProxy.createProxyServer({
  4. });
  5. proxy.on("error", function(err, req, res, urla){
  6. res.write(JSON.stringify(err,true,2));
  7. res.end();
  8. })
  9. http.createServer(function(req, res) {
  10. req.url = '/wp-json/metrics';
  11. proxy.web(req, res, { target: 'http://192.168.1.61:9118' });
  12. }).listen(9117);