You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When origin has a function logic it prevents to be overwritten on a next() by another cors policy when preflightContinue is set true.
Example:
const allowedOrigins = [`${config.frontendUrl}`];
// enable cors
app.use(cors({
origin: function(origin, callback){
if(!origin) return callback(null, true);
if(allowedOrigins.indexOf(origin) === -1){
const msg = 'The CORS policy for this site does not ' +
'allow access from the specified Origin.';
return callback(new Error(msg), false);
}
return callback(null, true);
},
credentials: true,
// Allow follow-up middleware to override this CORS for options
preflightContinue: true,
}));
This should be applied everywhere exept if redefined like
When origin has a function logic it prevents to be overwritten on a next() by another cors policy when preflightContinue is set true.
Example:
This should be applied everywhere exept if redefined like
In this example /test will always be blocked by cors policy, if instead I use origin: allowedOrigins (Array value) it works. Any ideas?
#40
The text was updated successfully, but these errors were encountered: