HTTPREF
← Back to headers

HTTP Header

X-Forwarded-For

Networking

Carries the original client IP address when requests pass through proxies or load balancers.

HTTP header reference, syntax, examples, and developer usage.

What is the X-Forwarded-For header?

The X-Forwarded-For HTTP header is used to transmit metadata between a client and server as part of HTTP requests or responses.

HTTP headers define how content should be interpreted, cached, authenticated, secured, or processed by browsers and APIs.

Direction

This header may appear in both HTTP requests and responses.

Syntax

X-Forwarded-For: client, proxy1, proxy2

Example

X-Forwarded-For: 203.0.113.1

Common use cases

  • Reverse proxy setups
  • Client IP logging
  • Rate limiting and analytics

Common mistakes

  • Using the header in the wrong request or response context
  • Sending invalid header values
  • Incorrect header syntax
  • Assuming the header automatically changes server behaviour

Related headers