2 months ago

laravel 7 cors fails to clear cached

Posted 2 months ago by Daxsis


  • Laravel 7 latest
  • Laragon latest
  • Windows 10
  • Composer latest
  • PHP 7.4.3


    'paths' => ['api/*'],

    'allowed_methods' => ['*'],

    'allowed_origins' => ['*'],

    'allowed_origins_patterns' => [],

    'allowed_headers' => ['*'],

    'exposed_headers' => false,

    'max_age' => false,

    'supports_credentials' => false,


php artisan clear-compiled
php artisan optimize:clear
php artisan cache:clear
php artisan config:clear
php artisan route:clear

I know it is repetitive, however I still get

Access to fetch at 'http://laravel.test/api/test' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values '*, http://localhost:3000', but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I was just testing all possibilities.

Restarted Laragon a few times between a few tests. Cleared bootstrap\cache\*.php

Even if I put just 'http://localhost:3000' into allowed origins, still the same answer. I'm kinda lost.

The most absurd thing is that laravel returns 204 https://gyazo.com/599991eb02ebdfbfcb57ed5a7d3c1a03

In advance thank you for the answers.

Please sign in or create an account to participate in this conversation.