No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Quasar/Laravel CORS issue with POSTs

    Help
    1
    2
    362
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • digiproduct
      digiproduct last edited by digiproduct

      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?

      1 Reply Last reply Reply Quote 0
      • digiproduct
        digiproduct last edited by digiproduct

        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 😁

        1 Reply Last reply Reply Quote 0
        • First post
          Last post