Skip to content

Deploying to multi-node / cluster environments like k8s and impact on sessions, etc. #2727

Answered by rmunn
205g0 asked this question in Q&A
Discussion options

You must be logged in to vote

Session handling is left up to you, using the provided hooks. In the configuration you're describing, you would write a handle hook runs first, takes the request, and extracts (for example) a session ID from a cookie and attaches that session ID to request.locals. Then the getSession hook would run, talk to the database and fetch the session data given the session ID, and return an object with the session data that the client should see (which will populate the $session store on the client). (Note: You could also do the DB query in the handle hook rather than the getSession hook, depending on whether you want that session data loaded for endpoints or just for pages. The best way to do tha…

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@Angie9218
Comment options

Answer selected by benmccann
Comment options

You must be logged in to vote
1 reply
@Angie9218
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@CaptainCodeman
Comment options

@lkj4
Comment options

@CaptainCodeman
Comment options

@lkj4
Comment options

@CaptainCodeman
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #2716 on November 02, 2021 17:32.