生产环境,SSL和socket.io错误

时间:2015-06-17 06:07:33

标签: node.js express nginx socket.io

上下文

我们最近投入生产NodeJS服务器。

我们使用Express 4.x和Socket.IO 1.x,在像Socket.IO文档这样的端口上解释了这一点。

  • 它正在侦听端口10 000并使用Express + Socket.IO
  • 在同一台机器上,我们有一个可从NginX服务器访问的角度前端。
  • NginX服务器具有从/ api到NodeJS服务器的反向代理重定向
  • 因此,当前端(Angular)向/ api发送请求时,它可以很好地获取所需的数据结果集
  • 我们在/socket.io上添加了一个重定向,从Socket.IO库中的端口80到端口10000上的NodeJS服务器的轮询请求
  • 重定向在我服务器上有很多请求的意义上很有效。

问题

实际上,我们可以在生产中访问/ api。但似乎我对/socket.io上的调用有问题。实际上,每个轮询请求(在我们的例子中这么多)都会向我发送一个类似下面的堆栈。

注意:我们在dev environnement(Windows Server)上没有这个问题,但是我们在生产中使用Debian。

NB2:我们在NGINX上使用SSL证书(处理请求的反向代理)

错误

12)
  at next (/isp/www/effi-report.com/www/api/node_modules/express/lib/router/index.js:261:10)
  at query (/isp/www/effi-report.com/www/api/node_modules/express/lib/middleware/query.js:28:5)
  at Layer.handle [as handle_request] (/isp/www/effi-report.com/www/api/node_modules/express/lib/router/layer.js:82:5)
  at trim_prefix (/isp/www/effi-report.com/www/api/node_modules/express/lib/router/index.js:302:13)
  at /isp/www/effi-report.com/www/api/node_modules/express/lib/router/index.js:270:7
  at Function.proto.process_params (/isp/www/effi-report.com/www/api/node_modules/express/lib/router/index.js:321:12)
  at next (/isp/www/effi-report.com/www/api/node_modules/express/lib/router/index.js:261:10)
  at Function.proto.handle (/isp/www/effi-report.com/www/api/node_modules/express/lib/router/index.js:166:3)
  at EventEmitter.app.handle (/isp/www/effi-report.com/www/api/node_modules/express/lib/application.js:170:10)
  at Server.app (/isp/www/effi-report.com/www/api/node_modules/express/lib/express.js:28:9)
  at Server.<anonymous> (/isp/www/effi-report.com/www/api/node_modules/socket.io/node_modules/engine.io/lib/server.js:369:22)
  at Server.<anonymous> (/isp/www/effi-report.com/www/api/node_modules/socket.io/lib/index.js:258:16)
  at Server.emit (events.js:98:17)
  at HTTPParser.parser.onIncoming (http.js:2108:12)
  at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
  at Socket.socket.ondata (http.js:1966:22)
  at TCP.onread (net.js:527:27)

0 个答案:

没有答案