What is X-Forwarded-For

--> A Secure Network Address Translation (SNAT) is an object that maps an original client IP address to a translation address defined on the BIG-IP device.

--> When the BIG-IP system receives a request from a client IP address, and if the client IP address in the request is defined in a SNAT, the BIG-IP system translates the source IP address of the incoming packet to the SNAT address.

--> When the BIG-IP system translates the source IP address of the incoming packet to the SNAT address, the web server sees the request as originating from the SNAT address, not the original client IP address.

--> If the web servers are required to log the original client IP address for requests, the SNAT address translation behavior can become problematic.



--> It may be necessary for the BIG-IP system to insert the original client IP address in an HTTP header and configure the web server that is receiving the request to log the client IP address instead of the SNAT address.

--> X-Forwarded-For is an HTTP header field used to identify the originating IP address of a client connecting to any web server via Proxy Server or Load Balancer.

--> It is not possible to know the originating IP address of the user via proxy if X-Forwarded-For is not used.

--> This header is used for debugging, statistics, and generating location-dependent content and by design, it exposes privacy-sensitive information, such as the IP address of the client. Therefore the user's privacy must be kept in mind when deploying this header.

--> Many servers and applications expect only a single X-Forwarded-For header, per request. However, the BIG-IP system appends a new X-Forwarded-For header to the existing set of HTTP headers, even if there is an existing X-Forwarded-For header in the request.

--> For applications expecting a single X-Forwarded-For header, it is possible to use an iRule instead of the HTTP profile option to append the client IP value to the end of any existing X-Forwarded-For header.

--> Syntax of X-Forwarded-For Header field can be shown in HTTP request as X-Forwarded-For: <client>, <proxy1>, <proxy2>

--> Client is the client IP address and <proxy1>, <proxy2> is if a request goes through multiple proxies, the IP addresses of each successive proxy is listed. This means, the right-most IP address is the IP address of the most recent proxy and the left-most IP address is the IP address of the originating client.

0 Comments