mirror of
https://github.com/bitwarden/server.git
synced 2025-01-13 20:21:22 +01:00
support X-Real-IP
This commit is contained in:
parent
43eeebdc21
commit
a416f5a912
@ -13,6 +13,7 @@ namespace Bit.Core
|
||||
public class CurrentContext
|
||||
{
|
||||
private const string CloudFlareConnectingIp = "CF-Connecting-IP";
|
||||
private const string RealIp = "X-Real-IP";
|
||||
|
||||
private bool _builtHttpContext;
|
||||
private bool _builtClaimsPrincipal;
|
||||
@ -182,6 +183,10 @@ namespace Bit.Core
|
||||
{
|
||||
return HttpContext.Request.Headers[CloudFlareConnectingIp].ToString();
|
||||
}
|
||||
if(globalSettings.SelfHosted && HttpContext.Request.Headers.ContainsKey(RealIp))
|
||||
{
|
||||
return HttpContext.Request.Headers[RealIp].ToString();
|
||||
}
|
||||
|
||||
return HttpContext.Connection?.RemoteIpAddress?.ToString();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user