Lumen 10 CORS not working / Lumen 10 無法使用第三方 CORS 套件

由於 Laravel 9.2 後就內建 CORS 的關係

Lumen 10 之後的版本也沒有第三方套件支援 CORS 了

這邊主要是在說明該如何設定內建的 CORS


1. 新增 config/cors.php

檔案可以去複製 Laravel 10 的 cors.php

2. 修改 bootstrap/app.php,加入以下這段 

$app->configure('cors');

$app->middleware([

    \Illuminate\Http\Middleware\HandleCors::class,

]);



Comments

Popular posts from this blog

CentOS7 如何新增/移除 Rich Rule for firewalld

mac 安裝 mtr

Howto use Postman test Cors