Answer the question
In order to leave comments, you need to log in
CORS not working mazite requests?
I am writing a webcam for Laravel on Vue as a separate project. Accordingly, they are running on different domains.
Added middleware CORS in Laravel itself
public function handle(Request $request, Closure $next)
{
return $next($request)
->header('Access-Control-Allow-Origin', '*')
->header('Access-Control-Allow-Headers', '*')
->header('Access-Control-Allow-Methods', '*');
}
Axios({method: 'post', url: '/api/page/' + page, data: {name: 'hello'}})
XMLHttpRequest cannot load http://127.0.0.1:8000/api/page/pk due to access control checks.
Failed to load resource: Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.
Answer the question
In order to leave comments, you need to log in
In the 8th lara, I didn’t seem to have any problems with cors.
https://laravel.com/docs/8.x/routing#cors
There is a separate config.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question