add manual set Access Control Allow Origin header

This commit is contained in:
Sorrel Bri 2020-01-18 01:30:15 -08:00 committed by sorrelbri
parent 891ba5ab2f
commit 2f9cb987ba

View file

@ -28,6 +28,11 @@ const corsOptions = {
app.options('*', cors(corsOptions)); app.options('*', cors(corsOptions));
app.use('*', cors(corsOptions)); app.use('*', cors(corsOptions));
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", allowedOrigin);
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
// disable logging for tests // disable logging for tests
if (process.env.NODE_ENV !== 'test') app.use(logger('dev')); if (process.env.NODE_ENV !== 'test') app.use(logger('dev'));