app: try to get real client ip

This commit is contained in:
DIYgod 2018-05-17 15:31:50 +08:00
parent 3d57e5ca75
commit 77014458d0
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
2 changed files with 2 additions and 1 deletions

View File

@ -22,6 +22,7 @@ process.on('uncaughtException', (e) => {
logger.info('🍻 RSSHub start! Cheers!');
const app = new Koa();
app.proxy = true;
// favicon
app.use(favicon(__dirname + '/favicon.png'));

View File

@ -1,7 +1,7 @@
const logger = require('../utils/logger');
module.exports = async (ctx, next) => {
logger.info(`${ctx.url}, user IP: ${ctx.ip}`);
logger.info(`${ctx.url}, user IP: ${ctx.ips[0] || ctx.ip}`);
const headers = {
'Access-Control-Allow-Origin': '*',