Windshaft-cartodb/lib/cartodb/api/middlewares/cors.js
2018-04-09 16:18:30 +02:00

19 lines
464 B
JavaScript

module.exports = function cors () {
return function corsMiddleware (req, res, next) {
const headers = [
'X-Requested-With',
'X-Prototype-Version',
'X-CSRF-Token'
];
if (req.method === 'OPTIONS') {
headers.push('Content-Type');
}
res.set("Access-Control-Allow-Origin", "*");
res.set("Access-Control-Allow-Headers", headers.join(', '));
next();
};
};