Answer the question
In order to leave comments, you need to log in
How to organize secure Vue-Laravel requests?
Hello, I'm just learning Vue and decided to start by making an authentication system (registration, login, etc.).
Requests are sent from Vue to Laravel, and I had to put these things in Laravel routes/api.php before the routes:
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, X-Auth-Token, Origin, Authorization');
header('Access-Control-Expose-Headers: Authorization');
for the reason that when I sent requests, an error related to CORS popped up. Googled that you need to insert these lines, but did not understand the issue of security.
Question: Is it safe to use the lines above? If not, what would you advise to avoid errors related to CORS
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question