Laravel middleware: Trying to get property headers of non-object
This error occurs generally when redirects are not properly handled in the laravel middleware
For example, sometimes if you are redircting like this, you may get "Trying to get property 'headers' of non-object" error.
For example, sometimes if you are redircting like this, you may get "Trying to get property 'headers' of non-object" error.
return route('home');
Solution:
Try to modify the same redirect as follows, it may fix the issue.
return redirect()->route('home');
Comments (0)