So FYI somehow I was able to fix the issue by adding the latter two lines to index.php in Laravel:
header("Access-Control-Allow-Origin: *");
header('Access-Control-Request-Headers: Content-Type');
header('Access-Control-Allow-Headers: Origin, Content-Type');
On the ReactJS side, I explicitly defined the 'Content-Type' of the request to 'application/json' but I'm not sure if that part is really necessary.
Note that even though I have added those headers to index.php, the AJAX requests look like they are going to do an 'OPTIONS' handshake before the actual payload request + response.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community