-1

am currently having a problem with Ionic 1 when using a release build on android 4.4. I keep getting a cors error. In addition am using a node.js back end with cors requests specified in it already. This is the error am seeing so far:

SEC7121: [CORS] The origin 'http://localhost:8100' found * in the Access-Control-Allow-Origin response header when the credentials mode was include for cross-origin resource at 'https://www.slywolf.co.za/api/auth/signin'.

Any assistance regarding this will be greatly appreciated.

Prashant Gupta
  • 788
  • 8
  • 26

1 Answers1

0

Add This as a middle ware in your node.js server.
This will allow cross origin request with Credentials

app.use(function(req, res, next) {
        res.header("Access-Control-Allow-Origin", "http://localhost:8100");
        res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
        res.header("Access-Control-Allow-Methods", "GET, POST,PATCH, DELETE, PUT");
         res.header("Access-Control-Allow-Credentials", true);
        next();
    });
Prashant Gupta
  • 788
  • 8
  • 26