pass x-forwarded-for to properly log proxied login/logout
This commit is contained in:
parent
8b06da5783
commit
e2116712e7
@ -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()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
@ -57,7 +58,9 @@ namespace WebfrontCore.Controllers
|
||||
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();
|
||||
@ -82,7 +85,9 @@ namespace WebfrontCore.Controllers
|
||||
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()
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user