CORS is driving me crazy

  • I’m stuck trying to get CORS to work. I’ve searched extensively but can’t find any definitive info about how to configure CORS in Quasar.

    I’m running Quasar using the quasar dev command. My app attempts to load a JavaScript library from another domain. When I try to load it, I get the error:

    Access to script at '' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    I tried installing the cors package and doing this in quasar.conf.js:

    devServer: {
                https: false,
                port: 8080,
                open: true, // opens browser window automatically
                headers: {
                    'Access-Control-Allow-Origin':  '*'
                    // 'Access-Control-Allow-Methods': '*',
                    // 'Access-Control-Allow-Headers': '*'
                before (app) {
                    const cors = require('cors')

    But it doesn’t seem to help.

    Can anyone tell me how to configure this? Thanks.

    1. Did you look at the request and did you confirm the cors header is missing?

    2. Is the server cors enabled?

    Maybe this will help:

  • Thanks for your quick reply. I’m new to Quasar and I don’t know how to do either of those things.

  • cors have to be configured on the server, not on the client. So it’s that needs to allow your localhost.

  • @PhilWritesCode

    1. you can check the request in the network tab of chrome dev tools( f12 or crt+shift+i)

    2. read for the server part

Log in to reply