From: Chocobozzz Date: Wed, 28 Mar 2018 12:51:50 +0000 (+0200) Subject: Fix views system behind a proxy X-Git-Tag: v1.0.0-beta.3~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e33e7fc89e4f0e2fbd1d7e87a4e2a2d5aae94f29;p=oweals%2Fpeertube.git Fix views system behind a proxy --- diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 552e5edac..c0a8ac118 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -353,7 +353,7 @@ function getVideo (req: express.Request, res: express.Response) { async function viewVideo (req: express.Request, res: express.Response) { const videoInstance = res.locals.video - const ip = req.ip + const ip = req.headers['x-real-ip'] as string || req.ip const exists = await Redis.Instance.isViewExists(ip, videoInstance.uuid) if (exists) { logger.debug('View for ip %s and video %s already exists.', ip, videoInstance.uuid)