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?