Commit e526a690 e526a69018b7c58450c05870cb6b69307b3eabf5 by mengfan.xie

Merge remote-tracking branch 'origin/release' into release

2 parents 31c8306a 207862db
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
3 namespace App\Http; 3 namespace App\Http;
4 4
5 use App\Http\Middleware\AuthIdentifier; 5 use App\Http\Middleware\AuthIdentifier;
6 use Fruitcake\Cors\HandleCors;
6 use Illuminate\Foundation\Http\Kernel as HttpKernel; 7 use Illuminate\Foundation\Http\Kernel as HttpKernel;
7 8
8 class Kernel extends HttpKernel 9 class Kernel extends HttpKernel
...@@ -17,7 +18,7 @@ class Kernel extends HttpKernel ...@@ -17,7 +18,7 @@ class Kernel extends HttpKernel
17 protected $middleware = [ 18 protected $middleware = [
18 // \App\Http\Middleware\TrustHosts::class, 19 // \App\Http\Middleware\TrustHosts::class,
19 \App\Http\Middleware\TrustProxies::class, 20 \App\Http\Middleware\TrustProxies::class,
20 \Fruitcake\Cors\HandleCors::class, 21 HandleCors::class,
21 \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 22 \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
22 \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 23 \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
23 \App\Http\Middleware\TrimStrings::class, 24 \App\Http\Middleware\TrimStrings::class,
......
This diff could not be displayed because it is too large.
...@@ -4,31 +4,57 @@ return [ ...@@ -4,31 +4,57 @@ return [
4 4
5 /* 5 /*
6 |-------------------------------------------------------------------------- 6 |--------------------------------------------------------------------------
7 | Cross-Origin Resource Sharing (CORS) Configuration 7 | Laravel CORS Options
8 |-------------------------------------------------------------------------- 8 |--------------------------------------------------------------------------
9 | 9 |
10 | Here you may configure your settings for cross-origin resource sharing 10 | The allowed_methods and allowed_headers options are case-insensitive.
11 | or "CORS". This determines what cross-origin operations may execute
12 | in web browsers. You are free to adjust these settings as needed.
13 | 11 |
14 | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS 12 | You don't need to provide both allowed_origins and allowed_origins_patterns.
13 | If one of the strings passed matches, it is considered a valid origin.
14 |
15 | If ['*'] is provided to allowed_methods, allowed_origins or allowed_headers
16 | all methods / origins / headers are allowed.
15 | 17 |
16 */ 18 */
17 19
18 'paths' => ['api/*', 'sanctum/csrf-cookie'], 20 /*
21 * You can enable CORS for 1 or multiple paths.
22 * Example: ['api/*']
23 */
24 'paths' => ['api/*', 'release/*'],
19 25
26 /*
27 * Matches the request method. `['*']` allows all methods.
28 */
20 'allowed_methods' => ['*'], 29 'allowed_methods' => ['*'],
21 30
31 /*
32 * Matches the request origin. `['*']` allows all origins. Wildcards can be used, eg `*.mydomain.com`
33 */
22 'allowed_origins' => ['*'], 34 'allowed_origins' => ['*'],
23 35
36 /*
37 * Patterns that can be used with `preg_match` to match the origin.
38 */
24 'allowed_origins_patterns' => [], 39 'allowed_origins_patterns' => [],
25 40
41 /*
42 * Sets the Access-Control-Allow-Headers response header. `['*']` allows all headers.
43 */
26 'allowed_headers' => ['*'], 44 'allowed_headers' => ['*'],
27 45
46 /*
47 * Sets the Access-Control-Expose-Headers response header with these headers.
48 */
28 'exposed_headers' => [], 49 'exposed_headers' => [],
29 50
51 /*
52 * Sets the Access-Control-Max-Age response header when > 0.
53 */
30 'max_age' => 0, 54 'max_age' => 0,
31 55
56 /*
57 * Sets the Access-Control-Allow-Credentials header.
58 */
32 'supports_credentials' => false, 59 'supports_credentials' => false,
33
34 ]; 60 ];
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
2 2
3 use Illuminate\Support\Facades\Route; 3 use Illuminate\Support\Facades\Route;
4 4
5 header("Access-Control-Allow-Origin: *");
6
7 /* 5 /*
8 |-------------------------------------------------------------------------- 6 |--------------------------------------------------------------------------
9 | API Routes 7 | API Routes
......