feat: add cors origin control into config (#6499)

This commit is contained in:
moonrailgun
2020-12-24 00:43:49 +08:00
committed by GitHub
parent 1f34bce335
commit fd8cb4a666
4 changed files with 11 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ module.exports = async (ctx, next) => {
logger.info(`${ctx.url}, user IP: ${ctx.ips[0] || ctx.ip}`);
ctx.set(headers);
ctx.set({
'Access-Control-Allow-Origin': `${ctx.host}`,
'Access-Control-Allow-Origin': `${config.allowOrigin || ctx.host}`,
});
await next();