Answers for "cannot use wildcard in access-control-allow-origin when credentials flag is true"

0

cannot use wildcard in access-control-allow-origin when credentials flag is true

var corsOptions = {
  origin: 'http://localhost:3000',
  credentials : true
 }

app.use(cors(corsOptions));

app.use(function (req, res, next) {	
    res.setHeader('Access-Control-Allow-Origin', 'http://localhost:3000');    
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');    
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');   
    res.setHeader('Access-Control-Allow-Credentials', true);    
    next();
});
Posted by: Guest on February-24-2021

Code answers related to "cannot use wildcard in access-control-allow-origin when credentials flag is true"

Code answers related to "Javascript"

Browse Popular Code Answers by Language