1

I have 3 projects which are build on sails. Each has 3 different port numbers (1337,1338 & 1339) are deployed on a single server. Two of these projects uses "req.session". While i open these 3 projects in multiple tabs in browser the projects that uses sessions are automatically redirecting to their corresponding login page when i do some user actions in the other tab and start working back in the loginned user page. Can anyone suggests why this happen ? The project that doesnot use session are working properly when i done some action in the sails project in other tabs. Opening a single project among the 3 are working fine in all cases. Opening the 3 projects in 3 different tabs in same browser makes the issue. Please help me.

Nidheesh
  • 37
  • 6
  • How did you configure your session ? Show us your config/session.js file Your 3 projects are 3 different sails projects or it's the same project launch 3 times ? – jaumard Jun 30 '15 at 09:27
  • no its 3 different projects...not have any internal connection. whenever a logined user makes a request i check for session "if(req.session.authenticated)" if true will proceed/...didnt done much in session.....also am not sure whether itz a session issue...because even when i click a button for showing an html pop up the page also gets redirecting when i do this after having some user action in the other sails project opened in the other tab. – Nidheesh Jun 30 '15 at 09:36
  • 2
    Cookies are shared across different ports of the same host (see http://stackoverflow.com/a/16328399), so they are interfering with each other. I don't know Sails intimately, but if you can change the cookie _name_ for each project, it may fix your problems. – robertklep Jun 30 '15 at 10:46
  • Thnx a lot....its really workz..!!! setting the key value different for different projects really solves the issue... – Nidheesh Jul 01 '15 at 05:15

1 Answers1

1

`module.exports.session = {

secret: 'fff33904bde73c43b1ad88af52d5e7cb', /* auto generated / key: 'Your_custom_key_here' , / default is sails.sid */

)`

This has fixed my issue...

Nidheesh
  • 37
  • 6