http-proxy


### function
```typeconst http = require('http')const httpProxy = require('http-proxy')const proxy = httpProxy.createProxyServer({})http.createServer(function (req, res) {  proxy.web(req, res, { target: 'http://localhost:3000' })}).listen(3333)proxy.on('error', function (err, req, res) {  if (err) console.log(err)  res.writeHead(500)  res.end('Ooops, something went very wrong...')})```

websocket support
```typeproxyServer.on('upgrade', function (req, socket, head) {  proxy.ws(req, socket, head);});```


> [How to create a simple http proxy in node.js?](https://stackoverflow.com/questions/20351637/how-to-create-a-simple-http-proxy-in-node-js)


> [Catch proxy error? · Issue #264 · http-party/node-http-proxy](https://github.com/http-party/node-http-proxy/issues/264)





