File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ SESSION_SECRET=
1919# Session idle timeout in milliseconds (default: 30 minutes)
2020# ADMIN_SESSION_IDLE_TIMEOUT_MS=1800000
2121
22+ # Whether the session cookie should only be sent over HTTPS.
23+ # Defaults to true in production, false otherwise.
24+ # SESSION_COOKIE_SECURE=true
25+
2226# ── Cache Control ────────────────────────────────────────────
2327# These mirror LibreChat's cache env vars. ADMIN_PANEL_* variants
2428# take precedence, falling back to the shared LibreChat equivalents.
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ const envIdleTimeout = Number(process.env.ADMIN_SESSION_IDLE_TIMEOUT_MS);
1010const effectiveIdleTimeout =
1111 Number . isFinite ( envIdleTimeout ) && envIdleTimeout > 0 ? envIdleTimeout : DEFAULT_IDLE_TIMEOUT_MS ;
1212
13+ const sessionCookieSecure =
14+ process . env . SESSION_COOKIE_SECURE !== undefined
15+ ? process . env . SESSION_COOKIE_SECURE === 'true'
16+ : process . env . NODE_ENV === 'production' ;
17+
1318export const SESSION_CONFIG = {
1419 revalidationInterval : REVALIDATION_INTERVAL_MS ,
1520 idleTimeout : effectiveIdleTimeout ,
@@ -33,7 +38,7 @@ export function useAppSession(): ReturnType<typeof useSession<t.SessionData>> {
3338 name : 'admin-session' ,
3439 password : sessionSecret || '' ,
3540 cookie : {
36- secure : process . env . NODE_ENV === 'production' ,
41+ secure : sessionCookieSecure ,
3742 sameSite : 'lax' ,
3843 httpOnly : true ,
3944 maxAge : 60 * 60 * 24 * 7 ,
You can’t perform that action at this time.
0 commit comments