I created a middleware and inject it to HTTP/Kernel.php before StartSession middleware.
this middleware is responsible for check user-agent from request to determine the type of visitor, if a user keeps session driver and config or changes it to cookie if middleware guessed request is not by a user.
but I don't know if this is a good approach or not.
Aug 15, 2020
3
Level 4
DB session driver and massive inserts
Hi all,
I am using version 6 of laravel, and use the database as a driver for the session. everything going well except that laravel create a row in the database for every request, even request from bot, spider, or load-balancer check, this is a big issue and create a massive row in sessions table in DB.
How can I create session only for authenticated users? what is the best approach to achieve these requirements?
ps:
- Redis driver has the same problem
- no needs for un-authorized user
- no needs for bots and spider
Please or to participate in this conversation.