what do you mean by "Laravel Syntax error"? There is no such thing, only PHP syntax errors. Your code should not have syntax errors to begin with.
Laravel Syntax error - missing Access-Control-Allowed-Origin header
I have a VUE SPA, and I use Laravel Sanctum on the server side. Authentication is happening with the standard cookie-based session authentication.
When I have a syntax error in the Laravel code, my frontend should receive the standard laravel error message (where is the syntax error, and what is it).
Sanctum and the CORS settings are set up correctly, because in case of a successfull response, I have the Access-Control-Allowed-Origin header correctly set. (localhost:5173 in my case)
But when there is an error, this response doesn't have this header, and I receive a CORS error. Why doesn't Laravel set the Access-Control-Allowed-Origin header in an error case? Do I need to define a custom middleware for this or can this be solved in Laravel CORS settings?
Error: login:1 Access to XMLHttpRequest at '...' from origin '...' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Please or to participate in this conversation.