Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
fix: Remove maxAge from default session cookie
Browse files Browse the repository at this point in the history
The options provided to `createCookieSessionStorage` are used as the default values of the session cookie. By setting `maxAge: 0` here, the session cookie will always be expired if the user doesn't override `maxAge` when they do `commitSession`. Leaving `maxAge` undefined will mean the cookie will expire when the browser session is closed. That is a reasonable default for a session cookie.

I believe this *bug* was originally in the Indie Stack that this tutorial was based on. The Stacks have since been fixed.
  • Loading branch information
kiliman authored and dvargas92495 committed Jul 22, 2022
1 parent f0d30ff commit 197f927
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion examples/blog-tutorial/app/session.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const sessionStorage = createCookieSessionStorage({
cookie: {
name: "__session",
httpOnly: true,
maxAge: 0,
path: "/",
sameSite: "lax",
secrets: [process.env.SESSION_SECRET],
Expand Down

0 comments on commit 197f927

Please sign in to comment.