Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules/
dist/
.env
.env*
!.env.example
*.tsbuildinfo
.DS_Store
npm-debug.log*
10 changes: 8 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ export function createApp(): express.Express {

// Demo-only session setup: the default in-memory store loses sessions on
// restart and doesn't scale past one process — use a shared store (e.g.
// connect-redis) in production, and set cookie.secure (plus
// app.set('trust proxy', 1) behind a proxy) once you're serving over HTTPS.
// connect-redis) in production. Secure (HTTPS-only) cookies switch on via
// NODE_ENV=production; trust proxy lets Express see the original protocol
// behind a TLS-terminating proxy so the cookie still gets set.
const isProduction = process.env.NODE_ENV === "production";
if (isProduction) {
app.set("trust proxy", 1);
}
app.use(
session({
secret: config.sessionSecret,
resave: false,
saveUninitialized: false,
cookie: {
httpOnly: true,
secure: isProduction,
// 'lax', not 'strict': the SSO callback arrives as a top-level GET
// redirect from WorkOS, and 'strict' would drop the session cookie on
// that navigation — breaking the state check.
Expand Down