Fix config issue
This commit is contained in:
25
app/Http/Middleware/TrustProxies.php
Normal file
25
app/Http/Middleware/TrustProxies.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Middleware\TrustProxies as LaravelTrustProxies;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class TrustProxies extends LaravelTrustProxies
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
if (config('cachet.trusted_proxies')) {
|
||||||
|
LaravelTrustProxies::at(explode(',', config('cachet.trusted_proxies')));
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::handle($request, $next);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use App\Http\Middleware\TrustProxies;
|
||||||
use App\Providers\AppServiceProvider;
|
use App\Providers\AppServiceProvider;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Illuminate\Foundation\Configuration\Exceptions;
|
use Illuminate\Foundation\Configuration\Exceptions;
|
||||||
@@ -26,7 +27,7 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||||||
->withMiddleware(function (Middleware $middleware) {
|
->withMiddleware(function (Middleware $middleware) {
|
||||||
$middleware->redirectGuestsTo(fn () => route('login'));
|
$middleware->redirectGuestsTo(fn () => route('login'));
|
||||||
$middleware->redirectUsersTo(AppServiceProvider::HOME);
|
$middleware->redirectUsersTo(AppServiceProvider::HOME);
|
||||||
$middleware->trustProxies(at: explode(',', config('cachet.trusted_proxies')));
|
$middleware->append(TrustProxies::class);
|
||||||
|
|
||||||
$middleware->throttleApi();
|
$middleware->throttleApi();
|
||||||
})
|
})
|
||||||
|
|||||||
0
routes/middleware.php
Normal file
0
routes/middleware.php
Normal file
Reference in New Issue
Block a user