You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
539 B
14 lines
539 B
const logger = require('../utils/logger'); |
|
const headers = { |
|
'Access-Control-Allow-Origin': '*', |
|
'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild', |
|
'Access-Control-Allow-Methods': 'PUT, POST, GET, DELETE, OPTIONS', |
|
'Content-Type': 'application/json; charset=UTF-8', |
|
'Cache-Control': 'no-cache', |
|
}; |
|
|
|
module.exports = async (ctx, next) => { |
|
logger.info(`${ctx.url}, user IP: ${ctx.ips[0] || ctx.ip}`); |
|
ctx.set(headers); |
|
await next(); |
|
};
|
|
|