From 7d9088be71e5162a3c4d5e13cd29d1385187abbe Mon Sep 17 00:00:00 2001 From: vedatakd Date: Mon, 19 Jul 2021 16:23:22 +0300 Subject: [PATCH] fixed cors --- composer.json | 3 ++- config/app.php | 1 + config/cors.php | 14 ++++++++------ config/streams.php | 4 +++- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index e7cb719fc..a3a892de4 100644 --- a/composer.json +++ b/composer.json @@ -84,7 +84,8 @@ "pusher/pusher-php-server": "^5.0", "simplepie/simplepie": "^1.5.0", "guzzlehttp/guzzle": "^7.3", - "visiosoft/connect-module": "^1.0" + "visiosoft/connect-module": "^1.0", + "fruitcake/laravel-cors": "^2.0" }, "replace": { "anomaly/streams-platform": "*" diff --git a/config/app.php b/config/app.php index 669168482..18cb9f7ad 100644 --- a/config/app.php +++ b/config/app.php @@ -213,6 +213,7 @@ return [ */ Anomaly\Streams\Platform\StreamsServiceProvider::class, Sentry\Laravel\ServiceProvider::class, + \Fruitcake\Cors\CorsServiceProvider::class ], diff --git a/config/cors.php b/config/cors.php index 598b61a86..684f5e8aa 100644 --- a/config/cors.php +++ b/config/cors.php @@ -12,11 +12,13 @@ return [ | */ - 'supportsCredentials' => false, - 'allowedOrigins' => ['*'],// ex: ['abc.com', 'api.abc.com'] - 'allowedHeaders' => ['*'], - 'allowedMethods' => ['*'],// ex: ['GET', 'POST', 'PUT', 'DELETE'] - 'exposedHeaders' => [], - 'maxAge' => 0, + 'paths' => ['*'], + 'allowed_methods' => ['*'], + 'allowed_origins' => ['*'], + 'allowed_origins_patterns' => [], + 'allowed_headers' => ['*'], + 'exposed_headers' => false, + 'max_age' => false, + 'supports_credentials' => false, ]; \ No newline at end of file diff --git a/config/streams.php b/config/streams.php index 7add737bb..56fdcff0e 100644 --- a/config/streams.php +++ b/config/streams.php @@ -90,7 +90,9 @@ return [ | */ - 'middleware' => [], + 'middleware' => [ + \Fruitcake\Cors\HandleCors::class, # this line + ], /* |--------------------------------------------------------------------------