From f6d538f4425ad90763c7f3d1f76d50d8e27f57e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20S=C3=A1?= Date: Wed, 24 Jul 2024 01:46:49 -0300 Subject: [PATCH] improve readme with new localtion of middleware definition --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index a3daa35..1cd4c84 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,35 @@ protected $middlewareGroups = [ ], ``` +On Laravel 11, the Kernel.php file is removed. +Now, you can add the middleware on `config/app.php` like the example below: + +```php + ->withMiddleware(function (Middleware $middleware) { + $middleware->group('saml', [ + \Illuminate\Cookie\Middleware\EncryptCookies::class, + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + \Illuminate\Session\Middleware\StartSession::class, + ]); + }) +``` + +if you are using Laravel 11 behind a proxy, you may need to append trustProxies on last example `config/app.php`: + +```php + ->withMiddleware(function (Middleware $middleware) { + $middleware->group('saml', [ + \Illuminate\Cookie\Middleware\EncryptCookies::class, + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + \Illuminate\Session\Middleware\StartSession::class, + ]); + + $middleware->trustProxies(at: [ + 'IP_FROM_YOUR_PROXY', + ]); + }) +``` + ### Logging out There are two ways the user can logout: