【发布时间】:2022-01-27 04:44:15
【问题描述】:
我正在创建 React 和 Laravel 网站,控制台中显示了以下问题。
cors.php
<?php
return [
'paths' => ['api/*','login','register','admin/*','sanctum/csrf-cookie'],
'allowed_methods' => ['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS'],
'allowed_origin' => ['http://localhost:3000'],
'allowed_origins_patterns' => [],
'allowed_headers' => [
'Content-Type',
'Authorization',
'Accept',
'Accept-Language',
'Content-Language',
'Origin',
'X-Requested-With',
'X-XSRF-TOKEN',
//'X-CSRF-TOKEN',
'Access-Control-Request-Methods',
'Access-Control-Request-Headers'
],
'exposed_headers' => [
// 'Access-Token',
// 'Uid',
'Authorization',
'X-CSRF-TOKEN'
],
'max_age' => 0,
'supports_credentials' => true,
];
我的 cors.php 有什么问题,我放的有效和无效标头是什么?
【问题讨论】:
-
这能回答你的问题吗? CORS Issue with React app and Laravel API
标签: reactjs laravel http-headers