Level 13
To fix this issue i removed
"fruitcake/laravel-cors": "^1.0",
and updated it to
"fruitcake/laravel-cors": "^2.0",
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I recently uploaded my Laravel API to Laravel Forge, however when i try to access the api from a Nuxt app hosted on Netlify, i'm getting CORS errors:
Access to XMLHttpRequest at 'API-url' from origin 'Nuxt App-url' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Both of the sites are running https.
My Laravel 7 CORS config file looks like this:
return [
'paths' => ['api/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => true,
]
Everything works as expected locally when i run the Laravel Api via valet and my Nuxt app on a regular localhost:3000.
Could this have anything to do with the nginx settings on Forge?
To fix this issue i removed
"fruitcake/laravel-cors": "^1.0",
and updated it to
"fruitcake/laravel-cors": "^2.0",
Please or to participate in this conversation.