Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

halfblod's avatar

middleware define in bootstrap/app.php dont access to session

hi every one I have a issue with middleware which i defined inside bootstrap/app.php in laravel 11 these middlewares does not have access to session (read/write)

(if i manually same middleware for route inside route/web.php for my routes, those middleware works perfectly)

I checked with laravel 9 which I define same midddleware inside kernel.php, it work correctly

what should I do to define global middleware inside app.php and access to the session?

0 likes
3 replies
halfblod's avatar

@jlrdw yeah, with using this, session not accessable inside middleware, but that same middleware if I added manually to route/web.php, worked perfectly fine!

Please or to participate in this conversation.