I'm getting bellow warning when using NODE_ENV=production
. What's the fix for this?
Warning: connection.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and obviously only work within a single process.
If your Internet connection is unstable, periodically disconnecting and reconnecting, it can cause a website session to expire. When the Internet connection is lost the website connection can be terminated, resulting in a session expired message if you try to access any page after the Internet reconnects.
To resolve this problem, determine which application is using the same port as RDP. If the port assignment for that application cannot be changed, change the port assigned to RDP by changing the registry. After you change the registry, you must restart the Remote Desktop Services service.
It could be a good idea to use Redis as your session manager. It appears as though you're using either the Express or Connect framework, and for either of them you could use an npm package connect-redis (having installed Redis). With that installed the express code would look something like this:
var express = require ( 'express' )
, RedisStore = require ( 'connect-redis' ) ( express )
, sessionStore = new RedisStore ()
, app = express.createServer ()
;
app.configure ( function () {
app.use ( express.cookieParser () );
app.use ( express.session ( {
secret: "keyboard cat", store: sessionStore, key: 'hello.sid'
} ) );
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With