laravel_session cookie added to web routes by default
Version
v5
What did you expect to happen?
No set-cookie headers added for anonymous visitors
What actually happens?
laravel_session cookie added to responses
Steps to reproduce
request any route with web middleware applied
System info
No response
Log output
No response
Please confirm this isn't a support request.
Yes
I know I can turn off the session middleware stuff but would be better if those were opt-in or all page caches will break by default
Are you mainly referring to when on WordPress routes? Otherwise, Laravel always creates a session cookie like that with the session middleware.
When on WordPress routes. Im fine just removing the middleware though if you do want to go with this as the default. But I guess others might find it unexpected too since you cant cache responses with set-cookie and Europeans need to declare the cookie in a policy.
yeah it should definitely be easier to configure and have some saner defaults for wordpress. will figure something out 🙏
is there any way to totally disable the session cookie??
Application::configure()
->withProviders([
])
->withMiddleware(function (Middleware $middleware) {
$middleware->removeFromGroup('web', [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
]);
})
->boot();
@oxyc, thank you very much. But where I write this code? It is not possible to add in vendor folder.