This repository was archived by the owner on Feb 16, 2023. It is now read-only.
This repository was archived by the owner on Feb 16, 2023. It is now read-only.
Laravel 8 Error Cors #539
Open

Description
I have an Api Rest with Laravel 8 and a front-end with VueJS, everything works fine from postman, but when making requests from Vue it gives cors error.
I also tried creating a Cors middleware that contains the following:
public function handle(Request $request, Closure $next)
{
return $next($request)->header('Access-Control-Allow-Origin', '*')
->header('Access-Control-Allow-Methods','GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS')
->header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
}
It also keeps throwing cors error, the library that includes the laravel version is: "fruitcake / laravel-cors": "^ 2.0", but this still doesn't work.
How could I fix my cors error?
Metadata
Metadata
Assignees
Labels
No labels