Quasar/Laravel CORS issue with POSTs
-
I’m wondering if there are any Laravel and Quasar experts on here who can help me with a CORS issue on my Quasar integration to my Laravel backend …
I’ve installed the Laravel-Cors package and can successfully do GET requests …
However, now that I’m attempting to do POST requests, I get a CORS error on all my POST requests.
I believe I have the CORS backend setup correctly with the correct settings …
The CORS.php contains
/* |-------------------------------------------------------------------------- | Laravel CORS |-------------------------------------------------------------------------- | | allowedOrigins, allowedHeaders and allowedMethods can be set to array('*') | to accept any value. | */ 'supportsCredentials' => false, 'allowedOrigins' => ['*'], 'allowedOriginsPatterns' => [], 'allowedHeaders' => ['*'], 'allowedMethods' => ['PUT, GET, POST, DELETE, OPTION'], 'exposedHeaders' => [], 'maxAge' => 0,
I’ve also tried that with the default settings as follows:-
/* |-------------------------------------------------------------------------- | Laravel CORS |-------------------------------------------------------------------------- | | allowedOrigins, allowedHeaders and allowedMethods can be set to array('*') | to accept any value. | */ 'supportsCredentials' => false, 'allowedOrigins' => ['*'], 'allowedOriginsPatterns' => [], 'allowedHeaders' => ['*'], 'allowedMethods' => ['*'], 'exposedHeaders' => [], 'maxAge' => 0,
Any suggestions?
-
Solved with some help from @metalsadman … not 100% sure what finally solved it … but adding
Barryvdh\Cors\ServiceProvider::class,
into config/app.php was one of the things that we did …
and adding …
\Barryvdh\Cors\HandleCors::class,
into the ‘api’ middleware in kernel.php was another things that we did.
Anyway … got it working now … thanks to @metalsadman