Add ALLOW_INSECURE_COOKIES env flag for HTTP access in production

Browsers drop Secure cookies on plain-http origins, so logging into the
admin over a LAN/VPN IP (e.g. during server migration, before TLS is in
front) silently failed every authenticated request. Setting
ALLOW_INSECURE_COOKIES=true omits the Secure flag; default behavior in
production is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-07-07 12:49:37 -04:00
parent f4fd177421
commit 2e406af471
3 changed files with 14 additions and 6 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { createHash, randomUUID } from 'node:crypto'
import path from 'node:path'
import { parseCookies } from './helpers.js'
import { parseCookies, cookieSecureFlag } from './helpers.js'
import {
STUDY_SESSION_COOKIE,
STUDY_SESSION_TTL_MS,
@@ -131,7 +131,7 @@ export function getStudyAvatarUrl(subject) {
// ── Session management ─────────────────────────────────────────────────────
export function cookieFlags() {
return process.env.NODE_ENV === 'production' ? '; Secure' : ''
return cookieSecureFlag()
}
export function createStudySession(userId) {