If you have Node.js and happen to be using Express, try putting code into app.js when you run into cross-domain problems.

app.all(The '*'.function(req, res, next) {
    // Set to the specified domain
    res.header('Access-Control-Allow-Origin'."*");
    res.header("Access-Control-Allow-Headers"."X-Requested-With");
    res.header('Access-Control-Allow-Headers'.'Content-Type');
    res.header("Access-Control-Allow-Methods"."PUT,POST,GET,DELETE,OPTIONS");
    res.header('Access-Control-Allow-Credentials'.true);
    res.header("X-Powered-By".'3.2.1');
    next();
  });Copy the code