From fadaf6765c7dfaaf6d40dbe5f1494c57734bea02 Mon Sep 17 00:00:00 2001 From: Giovanni-Josserand Date: Sat, 31 Jan 2026 17:26:20 +0100 Subject: [PATCH] test --- bootstrap/app.php | 4 ++++ config/app.php | 5 ----- config/cors.php | 7 +++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bootstrap/app.php b/bootstrap/app.php index 8ecbefe..a81367d 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -3,6 +3,7 @@ use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; +use Illuminate\Http\Middleware\HandleCors; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( @@ -14,6 +15,9 @@ return Application::configure(basePath: dirname(__DIR__)) ) ->withMiddleware(function (Middleware $middleware): void { $middleware->statefulApi(); + $middleware->api(prepend: [ + HandleCors::class, + ]); }) ->withExceptions(function (Exceptions $exceptions): void { // diff --git a/config/app.php b/config/app.php index 6d60cf8..423eed5 100644 --- a/config/app.php +++ b/config/app.php @@ -123,9 +123,4 @@ return [ 'store' => env('APP_MAINTENANCE_STORE', 'database'), ], - 'frontend' => [ - 'dev' => env('DEV', false), - 'dev_url' => env('FRONTEND_DEV_URL', 'http://localhost:5173'), - ], - ]; diff --git a/config/cors.php b/config/cors.php index 729082a..7e8c78f 100644 --- a/config/cors.php +++ b/config/cors.php @@ -19,10 +19,9 @@ return [ 'allowed_methods' => ['*'], - 'allowed_origins' => config('app.frontend.dev') - ? [config('app.frontend.dev_url')] - : ['*'], - + 'allowed_origins' => env('DEV', false) + ? ['http://localhost:5173', 'http://localhost:5174', 'http://localhost', 'http://localhost:80'] + : [env('APP_URL', 'http://localhost')], 'allowed_origins_patterns' => [],