Migrate to Fruitcake/laravel-cors which has path-exclusion built-in

This commit is contained in:
Brady Wetherington 2022-02-23 11:06:19 -08:00
parent 0cfc0a4bee
commit 15abc84ab0
4 changed files with 104 additions and 90 deletions

View file

@ -24,7 +24,7 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\SecurityHeaders::class,
\App\Http\Middleware\PreventBackHistory::class,
\Barryvdh\Cors\HandleCors::class,
\Fruitcake\Cors\HandleCors::class,
];

View file

@ -20,7 +20,6 @@
"adldap2/adldap2": "^10.2",
"alek13/slack": "^1.12",
"bacon/bacon-qr-code": "^1.0",
"barryvdh/laravel-cors": "^0.11.3",
"barryvdh/laravel-debugbar": "^3.2",
"doctrine/cache": "^1.10",
"doctrine/common": "^2.12",
@ -31,6 +30,7 @@
"enshrined/svg-sanitize": "^0.13.3",
"erusev/parsedown": "^1.7",
"fideloper/proxy": "^4.3",
"fruitcake/laravel-cors": "^2.2",
"guzzlehttp/guzzle": "^6.5",
"intervention/image": "^2.5",
"javiereguiluz/easyslugger": "^1.0",

175
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "252b4b452ca73e3e8f3d8543fce394d2",
"content-hash": "6bd73d729675b968cf296bdf68f6a523",
"packages": [
{
"name": "adldap2/adldap2",
@ -139,36 +139,36 @@
},
{
"name": "asm89/stack-cors",
"version": "1.3.0",
"version": "v2.1.1",
"source": {
"type": "git",
"url": "https://github.com/asm89/stack-cors.git",
"reference": "b9c31def6a83f84b4d4a40d35996d375755f0e08"
"reference": "73e5b88775c64ccc0b84fb60836b30dc9d92ac4a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/asm89/stack-cors/zipball/b9c31def6a83f84b4d4a40d35996d375755f0e08",
"reference": "b9c31def6a83f84b4d4a40d35996d375755f0e08",
"url": "https://api.github.com/repos/asm89/stack-cors/zipball/73e5b88775c64ccc0b84fb60836b30dc9d92ac4a",
"reference": "73e5b88775c64ccc0b84fb60836b30dc9d92ac4a",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"symfony/http-foundation": "~2.7|~3.0|~4.0|~5.0",
"symfony/http-kernel": "~2.7|~3.0|~4.0|~5.0"
"php": "^7.2|^8.0",
"symfony/http-foundation": "^4|^5|^6",
"symfony/http-kernel": "^4|^5|^6"
},
"require-dev": {
"phpunit/phpunit": "^5.0 || ^4.8.10",
"squizlabs/php_codesniffer": "^2.3"
"phpunit/phpunit": "^7|^9",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
"dev-master": "2.1-dev"
}
},
"autoload": {
"psr-4": {
"Asm89\\Stack\\": "src/Asm89/Stack/"
"Asm89\\Stack\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -189,9 +189,9 @@
],
"support": {
"issues": "https://github.com/asm89/stack-cors/issues",
"source": "https://github.com/asm89/stack-cors/tree/1.3.0"
"source": "https://github.com/asm89/stack-cors/tree/v2.1.1"
},
"time": "2019-12-24T22:41:47+00:00"
"time": "2022-01-18T09:12:03+00:00"
},
{
"name": "aws/aws-sdk-php",
@ -333,72 +333,6 @@
},
"time": "2017-10-17T09:59:25+00:00"
},
{
"name": "barryvdh/laravel-cors",
"version": "v0.11.4",
"source": {
"type": "git",
"url": "https://github.com/fruitcake/laravel-cors.git",
"reference": "03492f1a3bc74a05de23f93b94ac7cc5c173eec9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/03492f1a3bc74a05de23f93b94ac7cc5c173eec9",
"reference": "03492f1a3bc74a05de23f93b94ac7cc5c173eec9",
"shasum": ""
},
"require": {
"asm89/stack-cors": "^1.2",
"illuminate/support": "^5.5|^6",
"php": ">=7",
"symfony/http-foundation": "^3.1|^4",
"symfony/http-kernel": "^3.1|^4"
},
"require-dev": {
"laravel/framework": "^5.5",
"orchestra/testbench": "3.3.x|3.4.x|3.5.x|3.6.x|3.7.x",
"phpunit/phpunit": "^4.8|^5.2|^7.0",
"squizlabs/php_codesniffer": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.11-dev"
},
"laravel": {
"providers": [
"Barryvdh\\Cors\\ServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Barryvdh\\Cors\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application",
"keywords": [
"api",
"cors",
"crossdomain",
"laravel"
],
"support": {
"issues": "https://github.com/fruitcake/laravel-cors/issues",
"source": "https://github.com/fruitcake/laravel-cors/tree/v0.11.4"
},
"time": "2019-08-28T11:27:11+00:00"
},
{
"name": "barryvdh/laravel-debugbar",
"version": "v3.6.2",
@ -2042,6 +1976,85 @@
},
"time": "2021-06-23T19:00:23+00:00"
},
{
"name": "fruitcake/laravel-cors",
"version": "v2.2.0",
"source": {
"type": "git",
"url": "https://github.com/fruitcake/laravel-cors.git",
"reference": "783a74f5e3431d7b9805be8afb60fd0a8f743534"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/783a74f5e3431d7b9805be8afb60fd0a8f743534",
"reference": "783a74f5e3431d7b9805be8afb60fd0a8f743534",
"shasum": ""
},
"require": {
"asm89/stack-cors": "^2.0.1",
"illuminate/contracts": "^6|^7|^8|^9",
"illuminate/support": "^6|^7|^8|^9",
"php": ">=7.2"
},
"require-dev": {
"laravel/framework": "^6|^7.24|^8",
"orchestra/testbench-dusk": "^4|^5|^6|^7",
"phpunit/phpunit": "^6|^7|^8|^9",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
},
"laravel": {
"providers": [
"Fruitcake\\Cors\\CorsServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Fruitcake\\Cors\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fruitcake",
"homepage": "https://fruitcake.nl"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application",
"keywords": [
"api",
"cors",
"crossdomain",
"laravel"
],
"support": {
"issues": "https://github.com/fruitcake/laravel-cors/issues",
"source": "https://github.com/fruitcake/laravel-cors/tree/v2.2.0"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2022-02-23T14:25:13+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.5.5",
@ -11625,5 +11638,5 @@
"platform-overrides": {
"php": "7.2.5"
},
"plugin-api-version": "2.0.0"
"plugin-api-version": "2.1.0"
}

View file

@ -37,12 +37,13 @@ return [
|
*/
'supportsCredentials' => false,
'allowedOrigins' => $allowed_origins,
'allowedOriginsPatterns' => [],
'allowedHeaders' => ['*'],
'allowedMethods' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
'exposedHeaders' => [],
'maxAge' => 0,
'supports_credentials' => false,
'allowed_origins' => $allowed_origins,
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'allowed_methods' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
'exposed_headers' => [],
'max_age' => 0,
'paths' => ['api/*', 'sanctum/csrf-cookie'],
];