Quellcode durchsuchen

260427 cors設定

OMEGA\lulufj.ho vor 3 Wochen
Ursprung
Commit
e8828df37f
2 geänderte Dateien mit 15 neuen und 1 gelöschten Zeilen
  1. 3
    1
      bootstrap/app.php
  2. 12
    0
      config/cors.php

+ 3
- 1
bootstrap/app.php Datei anzeigen

@@ -12,7 +12,9 @@ return Application::configure(basePath: dirname(__DIR__))
12 12
         health: '/up',
13 13
     )
14 14
     ->withMiddleware(function (Middleware $middleware): void {
15
-        //
15
+        $middleware->api(prepend: [
16
+            \Illuminate\Http\Middleware\HandleCors::class,
17
+        ]);
16 18
     })
17 19
     ->withExceptions(function (Exceptions $exceptions): void {
18 20
         //

+ 12
- 0
config/cors.php Datei anzeigen

@@ -0,0 +1,12 @@
1
+<?php
2
+
3
+return [
4
+    'paths' => ['api/*'],
5
+    'allowed_methods' => ['*'],
6
+    'allowed_origins' => [env('FRONTEND_URL', 'https://ploom-qrcode.com')],
7
+    'allowed_origins_patterns' => [],
8
+    'allowed_headers' => ['*'],
9
+    'exposed_headers' => [],
10
+    'max_age' => 0,
11
+    'supports_credentials' => false,
12
+];