Back to HTTP Headers
Request

HTTP X-Forwarded-For Header

Identifies the originating IP address of a client connecting through a proxy or load balancer. The standard Forwarded header is preferred in modern applications.

Purpose

Preserves the original client IP address when requests pass through proxies, load balancers, or CDNs.

X-Forwarded-For: <client-ip> X-Forwarded-For: <client-ip>, <proxy1-ip>, <proxy2-ip> Example: X-Forwarded-For: 192.168.1.1 Example: X-Forwarded-For: 203.0.113.1, 10.0.0.1

Code Examples

See how to use the X-Forwarded-For header in different tools and languages.

curl -H "X-Forwarded-For: 203.0.113.1" https://api.example.com/data
# Simulates request coming from this IP through a proxy

Related Headers

Test Your APIs

x-forwarded-for headerhttp x-forwarded-forhttp headers guide