add frontend cors config
This commit is contained in:
parent
f9f253d04f
commit
4df8573b1c
2 changed files with 24 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ APP_ENV=local
|
|||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
CORS_ALLOWED_ORIGINS=http://localhost:5173,https://rabbigerzi.com,https://www.rabbigerzi.com
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
|
|
|
|||
23
backend/config/cors.php
Normal file
23
backend/config/cors.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
$defaultAllowedOrigins = implode(',', [
|
||||
'http://localhost:5173',
|
||||
'https://rabbigerzi.com',
|
||||
'https://www.rabbigerzi.com',
|
||||
]);
|
||||
|
||||
$allowedOrigins = array_values(array_filter(array_map(
|
||||
'trim',
|
||||
explode(',', (string) env('CORS_ALLOWED_ORIGINS', $defaultAllowedOrigins))
|
||||
)));
|
||||
|
||||
return [
|
||||
'paths' => ['login', 'logout', 'me'],
|
||||
'allowed_methods' => ['GET', 'POST', 'OPTIONS'],
|
||||
'allowed_origins' => $allowedOrigins,
|
||||
'allowed_origins_patterns' => [],
|
||||
'allowed_headers' => ['Content-Type', 'X-Requested-With', 'Accept', 'Origin'],
|
||||
'exposed_headers' => [],
|
||||
'max_age' => 0,
|
||||
'supports_credentials' => true,
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue