X-Forwarded-For (XFF)
X-Forwarded-For (XFF) is an HTTP header used to identify the originating IP address of a client connecting to a web server through intermediary devices such as proxy servers, load balancers, or firewalls. In modern network architectures, client requests often traverse multiple layers of infrastructure before reaching the destination server. Without this header, the server would only see the IP address of the last proxy in the chain, effectively masking the true client origin. XFF solves this by appending the original client IP — and the IPs of each subsequent proxy — as a comma-separated list within the header.
Proper use of the X-Forwarded-For header is essential for cybersecurity and network administration. It enables accurate logging for auditing and forensic investigations, helps identify malicious or suspicious traffic sources, and supports granular access control policies such as IP-based rate limiting and geolocation filtering. However, because XFF can be easily spoofed by malicious actors, it should never be blindly trusted. Organizations must validate and sanitize XFF values, typically by configuring trusted proxy chains, to ensure the integrity of the information used for security decisions.