cors.php 535 B

12345678910
  1. <?php
  2. return [
  3. 'paths' => ['api/*', 'chat/stream'], // 允许访问的路径
  4. 'allowed_methods' => ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
  5. 'allowed_origins' => ['http://localhost:3000', 'http://192.168.1.100:3000'], // 替换为你的前端地址
  6. 'allowed_headers' => ['Content-Type', 'Authorization'], // 允许的请求头
  7. 'exposed_headers' => [], // 暴露给前端的响应头
  8. 'max_age' => 0, // 预检请求的结果可以被缓存的时间
  9. 'supports_credentials' => false, // 是否支持凭证
  10. ];