0

我正在使用 http-proxy 将请求转发到特定端口

这是代码:

var httpProxy = require('http-proxy');

options   = {
    hostnameOnly:true,
    router: {
        'appname.nodejs.mydomain.com':'127.0.0.1:8001',
        'otherapp.nodejs.mydomain.com':'127.0.0.1:8002'
    }
}
httpProxy.createServer(options).listen(80);

当我开始它工作得很好但在线用户超过 300 个用户后,出现警告

we have 338 users online.
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use      emitter.setMaxListeners() to increase limit.
Trace
    at Socket.EventEmitter.addListener (events.js:175:15)
at Socket.EventEmitter.once (events.js:196:8)
at ClientRequest.HttpProxy.proxyRequest (/usr/local/lib/node_modules/http-proxy/lib/node-http-proxy/http-proxy.js:316:12)
at ClientRequest.g (events.js:192:14)
at ClientRequest.EventEmitter.emit (events.js:126:20)
at ClientRequest.onSocket (http.js:1525:9)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
we have 339 users online.

你能给我关于这个问题的任何建议吗?

4

0 回答 0