How to get cors headers working in Laravel 9

  Kiến thức lập trình

For some reason, cors headers are not showing up in my Laravel 9 application. I’ve set the URLs in config/cors.php, allowed_origin, but i still get “(Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 403.” and i don’t see the correct header when i look at the request headers in the web console. is there something i need to do turn cors on?

in config/cors.php, i have the following (i know i only need one of the domains but i was going to figure out which domain once it worked at all.)

'allowed_origins' => ['', ''],

New contributor

Richard Welty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.