pass x-forwarded-for to properly log proxied login/logout

This commit is contained in:
RaidMax
2021-07-05 16:08:13 -05:00
parent 8b06da5783
commit e2116712e7
2 changed files with 13 additions and 4 deletions

View File

@ -125,7 +125,9 @@ namespace WebfrontCore.Controllers.API
Origin = privilegedClient,
Type = GameEvent.EventType.Login,
Owner = Manager.GetServers().First(),
Data = HttpContext.Connection.RemoteIpAddress.ToString()
Data = HttpContext.Request.Headers.ContainsKey("X-Forwarded-For")
? HttpContext.Request.Headers["X-Forwarded-For"].ToString()
: HttpContext.Connection.RemoteIpAddress.ToString()
});
return Ok();
@ -152,7 +154,9 @@ namespace WebfrontCore.Controllers.API
Origin = Client,
Type = GameEvent.EventType.Logout,
Owner = Manager.GetServers().First(),
Data = HttpContext.Connection.RemoteIpAddress.ToString()
Data = HttpContext.Request.Headers.ContainsKey("X-Forwarded-For")
? HttpContext.Request.Headers["X-Forwarded-For"].ToString()
: HttpContext.Connection.RemoteIpAddress.ToString()
});
}