fix(session): update session middleware configuration
- Changed session middleware settings to resave sessions when uninitialized and prevent saving uninitialized sessions. - Updated cookie settings to enable httpOnly and set secure to false, enhancing security measures for session management.
This commit is contained in:
@@ -9,8 +9,8 @@ export default session({
|
|||||||
name: process.env.SESSION_NAME,
|
name: process.env.SESSION_NAME,
|
||||||
secret: process.env.SESSION_SECRET || "development-secret-key",
|
secret: process.env.SESSION_SECRET || "development-secret-key",
|
||||||
proxy: false,
|
proxy: false,
|
||||||
resave: false,
|
resave: true,
|
||||||
saveUninitialized: true,
|
saveUninitialized: false,
|
||||||
rolling: true,
|
rolling: true,
|
||||||
store: new pgSession({
|
store: new pgSession({
|
||||||
pool: db.pool,
|
pool: db.pool,
|
||||||
@@ -18,8 +18,8 @@ export default session({
|
|||||||
}),
|
}),
|
||||||
cookie: {
|
cookie: {
|
||||||
path: "/",
|
path: "/",
|
||||||
// secure: isProduction(),
|
httpOnly: true,
|
||||||
// httpOnly: isProduction(),
|
secure: false,
|
||||||
// sameSite: "none",
|
// sameSite: "none",
|
||||||
// domain: isProduction() ? ".worklenz.com" : undefined,
|
// domain: isProduction() ? ".worklenz.com" : undefined,
|
||||||
maxAge: 30 * 24 * 60 * 60 * 1000 // 30 days
|
maxAge: 30 * 24 * 60 * 60 * 1000 // 30 days
|
||||||
|
|||||||
Reference in New Issue
Block a user