-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
Description
Not sure how to fix this but this method.
private static string IpFromXForwardedFor(HttpRequest request)
{
var forwardedFor = request.Headers["X-Forwarded-For"];
if (!string.IsNullOrEmpty(forwardedFor) && forwardedFor.Contains(","))
{
forwardedFor = forwardedFor.Split(',').Last().Trim();
}
return forwardedFor;
}Didn't work well with my setup with Cloudflare. My header was like this.
X_FORWARDED_FOR: 196.215.208.37, 197.214.212.59:57956
Where the first one is the "good ip" and the second one is from Cloudflare. RollbarSharp was taking the last one and Rollbar didn't even accept that as an IP (because of the port i guess) and well it's the Cloudflare IP anyway so not that interesting. Just wanted to let you know. I run with a fork now where i take the first IP instead.