Multiple Laravel 5 projects on the same domain

后端 未结 5 1475
星月不相逢
星月不相逢 2020-12-18 13:10

I got several Laravel 5 projects running on subfolders, on the same domain.

Each Laravel application is generating it\'s own session cookie, and sometimes it generat

5条回答
  •  一整个雨季
    2020-12-18 14:01

    Since I found the solution, let me share with you guys.

    First, you need to use a shared session driver like Redis or database.

    Second, you need to set on config/session.php, the session cookie and path to be the same.

    After that, you can run as many different Laravel projects on the same domain without having problems with cookies.

    If your application does not require session at all, you can disable sessions entirelly on app/Http/Kernel.php, commenting the following lines:

    \Illuminate\Session\Middleware\StartSession::class,
    \Illuminate\Session\Middleware\AuthenticateSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class,
    \App\Http\Middleware\VerifyCsrfToken::class,
    

提交回复
热议问题