Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sailsjs using pm2 cluster mode and CSRF

Tags:

csrf

pm2

sails.js

I am running a sailsjs app with pm2 and its cluster mode.

The problem now is that since I am making cross domain requests with CSRF validation, only one of the clusters has the right access, the others give me the "CSRF mismatch error".

How do you use the pm2 with CSRF?

like image 742
Juan Solano Avatar asked Mar 05 '26 03:03

Juan Solano


1 Answers

sails.js has built-in support for using Redis or MongoDB to share session state across a cluster, for example with modulus.io, Heroku, or a self-hosted cluster using pm2. You can set the configuration values for this in config/session.js.

See:

  • setting up a redis shared session store
  • config/session.js reference
  • config/csrf.js reference
like image 82
Travis Webb Avatar answered Mar 08 '26 15:03

Travis Webb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!