-
When using session storage, it's possible to provide an expiry date on the cookie: const { getSession, commitSession, destroySession } =
createFileSessionStorage({
dir: "/app/sessions",
cookie: {
name: "__session",
expires: new Date(Date.now() + 60_000),
...,
},
}); When the However, if the cookie has expired the browser will no longer send it to the server, therefore the stored session will never be read and thus never removed. Am I missing something obvious here, or would a session never be removed? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes. You would need an external process that cleans up expired sessions. Remix can only clean up sessions that it tries to access, and if the session expired and the user never visits the site again, Remix wouldn't know to check it. Just run a cron job each night to clean up dead sessions. |
Beta Was this translation helpful? Give feedback.
Yes. You would need an external process that cleans up expired sessions. Remix can only clean up sessions that it tries to access, and if the session expired and the user never visits the site again, Remix wouldn't know to check it. Just run a cron job each night to clean up dead sessions.