Add Fruitcake CORS package and update CORS configuration to allow all methods, origins, and headers for improved API accessibility.
This commit is contained in:
@@ -10,6 +10,7 @@ use App\Ship\Middleware\LimitPost;
|
||||
use App\Ship\Middleware\RateLimitCheckMiddleware;
|
||||
use App\Ship\Middleware\RateLimitCounterMiddleware;
|
||||
use App\Ship\Middleware\TransformRequestMiddleware;
|
||||
use Fruitcake\Cors\HandleCors;
|
||||
use Illuminate\Foundation\Http\Kernel as LaravelHttpKernel;
|
||||
use Spatie\Permission\Middleware\PermissionMiddleware;
|
||||
use Spatie\Permission\Middleware\RoleMiddleware;
|
||||
@@ -25,11 +26,12 @@ class HttpKernel extends LaravelHttpKernel
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
HandleCors::class,
|
||||
TransformRequestMiddleware::class,
|
||||
// \App\Ship\Middleware\TrustHosts::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\App\Ship\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
// \Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Ship\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Ship\Middleware\TrimStrings::class,
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"filament/filament": "v3.2.127",
|
||||
"filament/spatie-laravel-settings-plugin": "^3.2",
|
||||
"filament/spatie-laravel-tags-plugin": "v3.2.113",
|
||||
"fruitcake/laravel-cors": "dev-develop",
|
||||
"guava/filament-icon-picker": "2.2.4",
|
||||
"guzzlehttp/guzzle": "^7.8",
|
||||
"imangazaliev/didom": "^2.0",
|
||||
|
||||
Generated
+142
-2
@@ -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": "43b10611f8194dcbafa73ce6ec065b66",
|
||||
"content-hash": "a5652249068f1290622c0a1375dc54fc",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alxdorosenco/porto-for-laravel",
|
||||
@@ -134,6 +134,62 @@
|
||||
},
|
||||
"time": "2025-04-06T06:54:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
"version": "v2.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/asm89/stack-cors.git",
|
||||
"reference": "acf3142e6c5eafa378dc8ef3c069ab4558993f70"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/asm89/stack-cors/zipball/acf3142e6c5eafa378dc8ef3c069ab4558993f70",
|
||||
"reference": "acf3142e6c5eafa378dc8ef3c069ab4558993f70",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"symfony/http-foundation": "^5.3|^6|^7",
|
||||
"symfony/http-kernel": "^5.3|^6|^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Asm89\\Stack\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alexander",
|
||||
"email": "iam.asm89@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Cross-origin resource sharing library and stack middleware",
|
||||
"homepage": "https://github.com/asm89/stack-cors",
|
||||
"keywords": [
|
||||
"cors",
|
||||
"stack"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/asm89/stack-cors/issues",
|
||||
"source": "https://github.com/asm89/stack-cors/tree/v2.3.0"
|
||||
},
|
||||
"time": "2025-03-13T08:50:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "awcodes/filament-tiptap-editor",
|
||||
"version": "v3.4.16",
|
||||
@@ -2258,6 +2314,88 @@
|
||||
},
|
||||
"time": "2024-11-27T16:52:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fruitcake/laravel-cors",
|
||||
"version": "dev-develop",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fruitcake/laravel-cors.git",
|
||||
"reference": "8cf86974af166a1d75d64c5776028652f486190f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/8cf86974af166a1d75d64c5776028652f486190f",
|
||||
"reference": "8cf86974af166a1d75d64c5776028652f486190f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"asm89/stack-cors": "^2.0.1",
|
||||
"illuminate/contracts": "^6|^7|^8|^9|^10",
|
||||
"illuminate/support": "^6|^7|^8|^9|^10",
|
||||
"php": ">=7.2",
|
||||
"symfony/http-foundation": "^4|^5|^6",
|
||||
"symfony/http-kernel": "^4.3.4|^5|^6"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/framework": "^6|^7.24|^8|^9|^10",
|
||||
"orchestra/testbench-dusk": "^4|^5|^6|^7|^8",
|
||||
"phpunit/phpunit": "^6|^7|^8|^9",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0-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/develop"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://fruitcake.nl",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/barryvdh",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"abandoned": true,
|
||||
"time": "2022-02-11T11:51:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fruitcake/php-cors",
|
||||
"version": "v1.3.0",
|
||||
@@ -13502,7 +13640,9 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": {},
|
||||
"stability-flags": {
|
||||
"fruitcake/laravel-cors": 20
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
||||
+5
-5
@@ -4,17 +4,17 @@ return [
|
||||
|
||||
'paths' => ['*'],
|
||||
|
||||
'allowed_methods' => ['GET', 'POST', 'PUT', 'DELETE'],
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => explode(',', env('CORS_ALLOWED_ORIGINS', 'https://www.ntspi.ru')),
|
||||
'allowed_origins' => ['*'],
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
|
||||
'allowed_headers' => ['Content-Type', 'X-Requested-With', 'Authorization'],
|
||||
'allowed_headers' => ['*'],
|
||||
|
||||
'exposed_headers' => [],
|
||||
|
||||
'max_age' => 3600,
|
||||
'max_age' => 0,
|
||||
|
||||
'supports_credentials' => true,
|
||||
'supports_credentials' => false,
|
||||
];
|
||||
Reference in New Issue
Block a user