true` may not be combined with a wildcard | origin — which is the browser telling you to name the origins anyway. | */ 'paths' => ['api/*'], 'allowed_methods' => ['*'], 'allowed_origins' => array_values(array_filter( explode(',', (string) env('API_ALLOWED_ORIGINS', '')), static fn (string $origin): bool => trim($origin) !== '', )), 'allowed_origins_patterns' => [], 'allowed_headers' => ['*'], // Without this a browser client can read the body but not the headers // that tell it how much allowance is left or when to retry — the two // things a well-behaved client needs in order to back off. 'exposed_headers' => [ 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'Retry-After', ], 'max_age' => 0, // Bearer tokens only: cookies must never travel cross-origin to this // API. See config/sanctum.php, where both `stateful` and `guard` are // empty for the same reason. 'supports_credentials' => false, ];