From 6b7c748251c1b89adfb1316ee99d6e8784471a0c Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Thu, 5 Jul 2018 09:25:35 +0200 Subject: [PATCH] Added a fallback for x-forwarded-for header --- src/app/core/auth/server-auth.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/auth/server-auth.service.ts b/src/app/core/auth/server-auth.service.ts index 5bcdd52003..96ee2e355a 100644 --- a/src/app/core/auth/server-auth.service.ts +++ b/src/app/core/auth/server-auth.service.ts @@ -28,7 +28,7 @@ export class ServerAuthService extends AuthService { headers = headers.append('Accept', 'application/json'); headers = headers.append('Authorization', `Bearer ${token.accessToken}`); // NB this is used to pass server client IP check. - const clientIp = this.req.get('x-forwarded-for'); + const clientIp = this.req.get('x-forwarded-for') || this.req.connection.remoteAddress; headers = headers.append('X-Forwarded-For', clientIp); options.headers = headers;