Cross-Origin Read Blocking (CORB) with app.request

Hi, the POSTand the GET in my app are blocked by cross-origin. I read on the docs that I can set the headers in this way:

 Framework7.request.setup({
    headers: {
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Headers': '*',
       'Content-type': 'text/javascript; charset=utf-8',
    }
})

I insered it in my-app.js after

 var app = new Framework7(…...code….);

However the request are blocked. How can I insert the header?

Thank you in advance

These headers must be set on server which handles requests

These headers must be set on server which handles requests

Vladimir’s right. I had the same problem. This node.js solution

  app.use(function (req, res, next) {

        // Website you wish to allow to connect
        res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8080');

        // Request methods you wish to allow
        res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');

        // Request headers you wish to allow
        res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');

        // Set to true if you need the website to include cookies in the requests sent
        // to the API (e.g. in case you use sessions)
        res.setHeader('Access-Control-Allow-Credentials', true);

        // Pass to next layer of middleware
        next();
    });
1 Like