Answer the question
In order to leave comments, you need to log in
How to make session lifetime different in laravel?
We have a website in laravel. Session lifetime is two weeks. The session driver is redis.
We noticed that there are about two million sessions in the radish, this cannot happen with our number of users.
We came to the conclusion that these are sessions that open during callback requests from third-party services (for example, callbacks from payment systems).
Is it possible to set different session times for different clients? For example, for authorized - 14 days, for unauthorized - a day or something like that?
Or somehow debuild the session manually on the necessary routes
Answer the question
In order to leave comments, you need to log in
Make it so that session-related middleware is not called for routes that are called by external services, you can do this, for example, by separating session middleware into a separate group in app/Http/Kernel.php. Well, it's best that they work through the api group with tokens, and not with sessions.
The session lifetime is specified in the laravel config. So you can manage this config.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question