Skip to content

Commit

Permalink
Merge branch 'Testing' into CN-Special
Browse files Browse the repository at this point in the history
  • Loading branch information
NikoCat233 committed Apr 21, 2024
2 parents 3b57b21 + 68e62b8 commit ba47248
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Impostor.Server/Http/TokenController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ public IActionResult GetToken([FromBody] TokenRequest request)

if (Request.Headers.TryGetValue("X-Forwarded-For", out var forwardedIps))
{
ipAddress = forwardedIps.First();
var forwardedIp = forwardedIps.First()!.Split(',').Select(ip => ip.Trim()).FirstOrDefault();
if (!string.IsNullOrEmpty(forwardedIp))
{
ipAddress = forwardedIp;
}
}

if (string.IsNullOrEmpty(ipAddress))
{
ipAddress = Request.HttpContext.Connection.RemoteIpAddress?.ToString();
}

if (string.IsNullOrEmpty(ipAddress))
Expand Down

0 comments on commit ba47248

Please sign in to comment.