After a few hours spent on how to deal with this situation I found a solution.
You have to overwiter SessionServiceProvider and register your CustomStartSession class there. After that everything works great
Cookie-less Session
For a few days I wonder whether or not I can create cookie-less session. Well I can remove all the cookies from the
web middleware but still the laravel session cookie is created.
I have purposely removed all other middleware because all I want to do is remove all cookies. This is my web middleware group:
'web' => [
\App\Middleware\CustomStartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
],
There are ways to identify the user browser by token used as cookie. I can give this token to the browser inside the requests'
headers. So basically I can remove all the cookies. Here is the problem. When I extend Laravel's StartSession class into
CustomStartSession ShareErrorsFromSession middleware stop to work.
class CustomStartSession extends \Illuminate\Session\Middleware\StartSession {}
The code is straightforward but ShareErrorsFromSession middleware does not work.
Can somebody give me a clue on how to get this to work, than I can modify CustomStartSession to remove the session cookies
and use the token.
Please or to participate in this conversation.