CORS config allowed_origins should be an array
Issue
Laravel 7 added the fruitcake/laravel-cors package by default. However, this package was previously named barryvdh/laravel-cors
. In addition, its configuration file has changed over the versions.
The combination of these may lead to some outdated code causing this error.
Solution
To resolve this error:
- If you are running Laravel 7 or higher, ensure you are properly including the
fruitcake/laravel-cors
package and update any references fromBarryvdh\Cors
toFruitcake\Cors
in your code. This is automated in the Laravel 7.x Shift. - Verify your
cors.php
file is up-to-date by republishing it withartisan vendor:publish --tag="cors
or comparing yours to the latest version. - Clear your application cache to remove any old references by running
artisan cache:clear
andartisan config:clear
.