Bugfix to SupportFuncations.GetMostLikelyRemoteIPAddress()

This commit is contained in:
Rick Falkvinge
2015-06-12 20:44:50 +02:00
parent 923cc877ba
commit 79f507087f
+8 -1
View File
@@ -63,6 +63,13 @@ namespace Swarmops.Logic.Support
// While it is possible to set up a server environment that strips out such fakes, doing so should not
// be a requirement for running Swarmops.
string cloudFlareClient = HttpContext.Current.Request.Headers["CF-Connecting-IP"];
if (!string.IsNullOrEmpty (cloudFlareClient))
{
return cloudFlareClient;
}
string forwardedIps =
HttpContext.Current.Request.Headers["X-Forwarded-For"];
@@ -71,7 +78,7 @@ namespace Swarmops.Logic.Support
if (!string.IsNullOrEmpty (forwardedIps))
{
return forwardedIps.Split (',').Last();
return forwardedIps.Split (',').First();
}
return directIp;