Shift with red gradient lettering

CORS config allowed_origins should be an array

CORS config allowed_origins should be an array

Explanation

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:

  1. If you are running Laravel 7 or higher, ensure you are properly including the fruitcake/laravel-cors package and update any references from Barryvdh\Cors to Fruitcake\Cors in your code. This is automated in the Laravel 7.x Shift.
  2. Verify your cors.php file is up-to-date by republishing it with artisan vendor:publish --tag="cors or comparing yours to the latest version.
  3. Clear your application cache to remove any old references by running artisan cache:clear and artisan config:clear.

← Back to the knowledge base

Did this solve the error? Give us a shout out on Twitter. If not, email support for help.

Sign in with any of the following services to connect Shift with your Laravel project.


Don't use one of these services?

Temporarily push your project to a free, private repository on one of these cloud-based services or upgrade your project locally with Shift for Docker.