Implement X-Forwarded-For Header to get Real Client IP Address (Who's on)
Idea shared by Jairo Marques - November 24, 2017 at 4:06 PM
Proposed
Hi Guys,
 
The X-Forwarded-For (XFF) HTTP header field is a standard method for identifying the originating IP address of a client connecting to a server through any proxy.

Proxies like KEMP LoadMaster, TMG (with a plugin), pfSense and others allows us to give the client's IP to the destination Real Server by inserting an additional HTTP header (called X-Forwarded-For) when L7 is used with non-transparency.

This option of inserting the HTTP header (called X-Forwarded-For) allows the client source IP address to be logged by the Real Server's IIS logs.

My idea is that SmartTrack use this method to catch the real client IP Address and use in Who's On feature.

Something like:

var forwardedFor = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

var userIpAddress = String.IsNullOrWhiteSpace(forwardedFor) ?
    Request.ServerVariables["REMOTE_ADDR"] : forwardedFor.Split(',').Select(s => s.Trim()).First();

Reply to Thread