mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
16 lines
554 B
JavaScript
16 lines
554 B
JavaScript
const logger = require('../utils/logger');
|
|
const config = require('../config');
|
|
const headers = {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With',
|
|
'Access-Control-Allow-Methods': 'GET',
|
|
'Content-Type': 'application/xml; charset=utf-8',
|
|
'Cache-Control': `max-age=${config.cacheExpire / 2}`,
|
|
};
|
|
|
|
module.exports = async (ctx, next) => {
|
|
logger.info(`${ctx.url}, user IP: ${ctx.ips[0] || ctx.ip}`);
|
|
ctx.set(headers);
|
|
await next();
|
|
};
|