1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
const cors = require('koa2-cors');
app.use(cors({ origin: function(ctx) { if (ctx.url === '/test') { return false; } return '*'; }, exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'], maxAge: 5, credentials: true, allowMethods: ['GET', 'POST', 'DELETE'], allowHeaders: ['Content-Type', 'Authorization', 'Accept'], }));
|
近期评论