<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Cross-Origin Resource Sharing (CORS) Configuration
    |--------------------------------------------------------------------------
    |
    | Here you may configure your settings for cross-origin resource sharing
    | or "CORS". This determines what cross-origin operations may execute
    | in web browsers. You are free to adjust these settings as needed.
    |
    | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
    |
    */

    'paths' => ['frontend/*', 'sanctum/csrf-cookie'],

    'allowed_methods' => ['*'],

    /*
     | Never '*' while supports_credentials is true: with credentials enabled that
     | makes php-cors reflect any Origin back with Access-Control-Allow-Credentials:
     | true (the OWASP reflect-any-origin-with-credentials anti-pattern). Origins are
     | allow-listed per request by App\Http\Middleware\ResolveCorsAllowedOrigins,
     | which validates the incoming Origin against the tenant's domains. This static
     | list is only for fixed origins such as local development.
     */
    'allowed_origins' => array_values(array_filter(
        array_map('trim', explode(',', (string) env('CORS_ALLOWED_ORIGINS', '')))
    )),

    'allowed_origins_patterns' => [],

    'allowed_headers' => ['*'],

    'exposed_headers' => [],

    'max_age' => 0,

    'supports_credentials' => true,

];
