Loravell

Everything works fine on my local system, but after deploying Laravel 5.2 on our test system, it seems like the session middleware is broken. Can anyone help here?

Argument 1 passed to Illuminate\Session\Middleware\    
StartSession::addCookieToResponse() must be an instance of  
Symfony\Component\HttpFoundation\Response, boolean given, called in   
... /httpdocs/service/vendor/laravel/framework/src/Illuminate/Session 
/Middleware/StartSession.php on line 72 and defined

Global Resellers:

protected $middleware = [
    \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
    \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
    \Illuminate\Session\Middleware\StartSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class,
    \App\Http\Middleware\CORSMiddleware::class,
    \LucaDegasperi\OAuth2Server\Middleware\OAuthExceptionHandlerMiddleware::class
];
+5
source share
3 answers

I have the same problem. When researching, I found that at some point in my code I used return.

It turns out (as you can see at the end of the handle method) that after executing the handle method you should always call return $next($request);,

+6
source

, addCookieToResponse Illuminate\Session\Middleware\StartSession , Response . , .

, .

:

Route::get('hi', function() {
    return 'hi';
});

:

Route::get('hi', function() {
    return response('hi');
});
+3

In my case, there was a problem with routes. There was a problem trying to log in because there was no route recorded for the requested path, followed by the method that I used. I just created a POST login path so that it works correctly:

 Route::post('login' , 'LoginController@store');
0
source

All Articles