Merge pull request #10720 from uberbrady/fix_cors_develop

Fix cors develop
This commit is contained in:
snipe 2022-02-22 19:23:43 -08:00 committed by GitHub
commit 292bf21e7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -24,6 +24,7 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\SecurityHeaders::class, \App\Http\Middleware\SecurityHeaders::class,
\App\Http\Middleware\PreventBackHistory::class, \App\Http\Middleware\PreventBackHistory::class,
\Fruitcake\Cors\HandleCors::class,
]; ];
@ -44,7 +45,6 @@ class Kernel extends HttpKernel
], ],
'api' => [ 'api' => [
\Fruitcake\Cors\HandleCors::class,
'throttle:120,1', 'throttle:120,1',
'auth:api', 'auth:api',
], ],

View file

@ -1,10 +1,14 @@
<?php <?php
$allowed_origins = env('CORS_ALLOWED_ORIGINS') !== null ?
explode(',', env('CORS_ALLOWED_ORIGINS')) : [];
return [ return [
'supportsCredentials' => false, 'supportsCredentials' => false,
'allowedOrigins' => ['*'], 'allowedOrigins' => $allowed_origins,
'allowedHeaders' => ['*'], 'allowedHeaders' => ['*'],