How to use sticky-session with cluster in express - node js

前端 未结 2 1437
不知归路
不知归路 2021-02-20 05:30

I created a cluster depending app with reference to this question

But I started facing issues in session handling. how to use sticky-session in express js with cluster.<

2条回答
  •  情歌与酒
    2021-02-20 06:00

    It has nothing to do with Express.

    You just forgot the listen() on the sticky function.

    sticky(
      http.createServer(app).listen(app.get('port'), function () {
          console.log('Express server listening on port ' + app.get('port'));
      });
    ).listen(app.get('port'),function() {
      console.log('Sticky server started on port' + app.get('port'));
    });
    

提交回复
热议问题