sidebase / nuxt-session

Nuxt session middleware to get a persistent session per app user, e.g., to store data across multiple requests. The nuxt session module provides the useSession() composable out of the box and sets up API endpoints to interact with your session to make working with sessions feel like a breeze.
https://sidebase.io/nuxt-session/
MIT License
189 stars 21 forks source link

The session is not being maintained #78

Open jinwoo-web opened 1 year ago

jinwoo-web commented 1 year ago

Ask your question

The session is not being maintained, and a new session ID is being created with each refresh. While the session persists on localhost:3000, it doesn't seem to be maintained when I switch to 192.168.0.*:3000. I'm wondering if I'm the only one experiencing this issue.

Additional information

No response

ceigey commented 1 year ago

(Writing as a prospective user) - I think this is typically a limitation of cookie based sessions, as otherwise other domains could intercept your cookies and start unofficially tracking and impersonating your users by using their cookies to make fraudulent requests, which is not safe.

I did notice there's a domain option, I would look into that if you haven't (it's not mentioned).

The domain would be based on what the browser perceives to be a domain, so nothing to do with your network topology. I imagine a browser doesn't consider localhost:3000 and 192.168.0.*:3000 to be the same.

As a user, I would expect you should be able to use the site on 192.168.0.*:3000 with one (un-interrupted) session, and use localhost:3000 with another (un-interrupted) session simultaneously, unless you design your Nuxt site to allow only one session per user (which seems out of scope for this library).