Kaynağa Gözat

260427 cors設定

OMEGA\lulufj.ho 3 hafta önce
ebeveyn
işleme
e8828df37f
2 değiştirilmiş dosya ile 15 ekleme ve 1 silme
  1. 3
    1
      bootstrap/app.php
  2. 12
    0
      config/cors.php

+ 3
- 1
bootstrap/app.php Dosyayı Görüntüle

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

+ 12
- 0
config/cors.php Dosyayı Görüntüle

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
+];