0

working with Angular 10 and Laravel 6 api project and now occurred following error message in my console here,

Access to XMLHttpRequest at 'http://127.0.0.1:8000/api/employees' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. `` how could I fix this problem here?

Harun Yilmaz
  • 8,281
  • 3
  • 24
  • 35
Okurawa
  • 23
  • 2
  • 9
  • 1
    Does this answer your question? [Laravel 5.1 API Enable Cors](https://stackoverflow.com/questions/33076705/laravel-5-1-api-enable-cors) – Harun Yilmaz Jul 28 '21 at 14:45
  • there is at least 10 other question about cors and laravel. search before posting your question https://stackoverflow.com/help/how-to-ask – N69S Jul 28 '21 at 14:57

1 Answers1

0

You can do this in bootstrap/app.php:

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');