I have an api on Laravel Lumen, we test via Postman and Ruby Rest Client and all go very well, but we create a simple Auth Login that response a web token, all works fine bu
Finally I found a clean way for it. Just add the following lines to the .htaccess (If you don't know, .htaccess has been located at public/.htaccess):
Header add Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "*"
Header set Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
Then, define a route in your Laravel/Lumen application like this:
Route::options('/{any:.*}', function() { return response(['status' => 'success']); });};
Of course you need mod-rewrite and mod-headers. You can enable them (if not already enabled) using the following commands (Ubuntu):
a2enmod rewrite
a2enmod headers
systemctl reload apache2