mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
optimize directory structure
This commit is contained in:
15
lib/middleware/header.js
Normal file
15
lib/middleware/header.js
Normal file
@@ -0,0 +1,15 @@
|
||||
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 , yourHeaderFeild',
|
||||
'Access-Control-Allow-Methods': 'PUT, POST, GET, DELETE, OPTIONS',
|
||||
'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();
|
||||
};
|
||||
Reference in New Issue
Block a user