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-corspackage and update any references fromBarryvdh\CorstoFruitcake\Corsin your code. This is automated in the Laravel 7.x Shift. - Verify your
cors.phpfile is up-to-date by republishing it withartisan vendor:publish --tag="corsor comparing yours to the latest version. - Clear your application cache to remove any old references by running
artisan cache:clearandartisan config:clear.