Answer the question
In order to leave comments, you need to log in
Access-Control-Allow-Origin error when requesting laravel server. What to do?
I am writing a client (login/registration) using VUE. When registering, I make a request to my own Laravel API. The following error pops up in the browser console
Failed to load test.ru/api/user/register: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' localhost:8080 ' is therefore not allowed access.
Answer the question
In order to leave comments, you need to log in
The essence of the problem is that POST requests from third-party domains are cut off for security reasons.
Solution, allow such requests. https://github.com/barryvdh/laravel-cors here is a package that might help
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question