Feb 7, 2023
0
Level 1
Shared session with subdomains using file session driver
I have two applications where I want to use shared session. Basically when user is authenticated in other, then he/she is also logged in in other app. Both apps are in same server and will use same database.
Implementing shared session would be easy with database driver but it can cause unexpected issues because the main site has lots of users and it uses database a lot.
Questions are:
- How can I implement shared session with redis or memcached? My guess is that I have to somehow make both apps save the session to same redis/memcached instance but I don't have any clue how to do that.
- Or is there any reason to NOT store session files outside the app root, for example in /home/session -folder and let both apps use the same folder? I already tried it out and shared sessions seem to work fine in local environment.
Please or to participate in this conversation.