<s>
The	O
X-Forwarded-For	B-Protocol
(	O
XFF	B-Protocol
)	O
HTTP	B-Protocol
header	I-Protocol
field	I-Protocol
is	O
a	O
common	O
method	O
for	O
identifying	O
the	O
originating	O
IP	B-Protocol
address	I-Protocol
of	O
a	O
client	O
connecting	O
to	O
a	O
web	B-Application
server	I-Application
through	O
an	O
HTTP	B-Protocol
proxy	B-Application
or	O
load	B-Application
balancer	I-Application
.	O
</s>
<s>
The	O
X-Forwarded-For	B-Protocol
HTTP	B-Protocol
request	O
header	O
was	O
introduced	O
by	O
the	O
Squid	B-Protocol
caching	O
proxy	B-Application
server	I-Application
's	O
developers	O
.	O
</s>
<s>
X-Forwarded-For	B-Protocol
is	O
also	O
an	O
email-header	O
indicating	O
that	O
an	O
email-message	O
was	O
forwarded	O
from	O
one	O
or	O
more	O
other	O
accounts	O
(	O
probably	O
automatically	O
)	O
.	O
</s>
<s>
Without	O
the	O
use	O
of	O
XFF	B-Protocol
or	O
another	O
similar	O
technique	O
,	O
any	O
connection	O
through	O
the	O
proxy	B-Application
would	O
reveal	O
only	O
the	O
originating	O
IP	B-Protocol
address	I-Protocol
of	O
the	O
proxy	B-Application
server	I-Application
,	O
effectively	O
turning	O
the	O
proxy	B-Application
server	I-Application
into	O
an	O
anonymizing	B-Protocol
service	I-Protocol
,	O
thus	O
making	O
the	O
detection	O
and	O
prevention	O
of	O
abusive	O
accesses	O
significantly	O
harder	O
than	O
if	O
the	O
originating	O
IP	B-Protocol
address	I-Protocol
were	O
available	O
.	O
</s>
<s>
The	O
usefulness	O
of	O
XFF	B-Protocol
depends	O
on	O
the	O
proxy	B-Application
server	I-Application
truthfully	O
reporting	O
the	O
original	O
host	O
's	O
IP	B-Protocol
address	I-Protocol
;	O
for	O
this	O
reason	O
,	O
effective	O
use	O
of	O
XFF	B-Protocol
requires	O
knowledge	O
of	O
which	O
proxies	B-Application
are	O
trustworthy	O
,	O
for	O
instance	O
by	O
looking	O
them	O
up	O
in	O
a	O
whitelist	O
of	O
servers	O
whose	O
maintainers	O
can	O
be	O
trusted	O
.	O
</s>
<s>
where	O
the	O
value	O
is	O
a	O
comma+space	O
separated	O
list	O
of	O
IP	B-Protocol
addresses	I-Protocol
,	O
the	O
left-most	O
being	O
the	O
original	O
client	O
,	O
and	O
each	O
successive	O
proxy	B-Application
that	O
passed	O
the	O
request	O
adding	O
the	O
IP	B-Protocol
address	I-Protocol
where	O
it	O
received	O
the	O
request	O
from	O
.	O
</s>
<s>
Because	O
the	O
X-Forwarded-For	B-Protocol
header	O
is	O
not	O
formally	O
standardized	O
,	O
some	O
variations	O
to	O
the	O
IP	B-Protocol
address	I-Protocol
format	O
exist	O
.	O
</s>
<s>
The	O
X-Forwarded-For	B-Protocol
header	O
is	O
added	O
or	O
edited	O
by	O
HTTP	B-Protocol
proxies	B-Application
when	O
forwarding	O
a	O
request	O
.	O
</s>
<s>
The	O
server	O
appends	O
the	O
address	O
of	O
the	O
client	O
to	O
an	O
existing	O
X-Forwarded-For	B-Protocol
header	O
separated	O
by	O
a	O
comma	O
,	O
or	O
creates	O
a	O
new	O
X-Forwarded-For	B-Protocol
header	O
with	O
the	O
client	O
address	O
as	O
the	O
value	O
.	O
</s>
<s>
Since	O
it	O
is	O
easy	O
to	O
forge	O
an	O
X-Forwarded-For	B-Protocol
field	O
the	O
given	O
information	O
should	O
be	O
used	O
with	O
care	O
.	O
</s>
<s>
The	O
right-most	O
IP	B-Protocol
address	I-Protocol
is	O
always	O
the	O
IP	B-Protocol
address	I-Protocol
that	O
connects	O
to	O
the	O
last	O
proxy	B-Application
,	O
which	O
means	O
it	O
is	O
the	O
most	O
reliable	O
source	O
of	O
information	O
.	O
</s>
<s>
X-Forwarded-For	B-Protocol
data	O
can	O
be	O
used	O
in	O
a	O
forward	O
or	O
reverse	B-General_Concept
proxy	I-General_Concept
scenario	O
.	O
</s>
<s>
If	O
the	O
server	O
is	O
behind	O
a	O
trusted	O
reverse	B-General_Concept
proxy	I-General_Concept
and	O
only	O
allows	O
connections	O
from	O
that	O
proxy	B-Application
,	O
the	O
header	O
value	O
can	O
usually	O
be	O
assumed	O
to	O
be	O
trustworthy	O
.	O
</s>
<s>
Just	O
logging	O
the	O
X-Forwarded-For	B-Protocol
field	O
is	O
not	O
always	O
enough	O
as	O
the	O
last	O
proxy	B-Application
IP	I-Application
address	I-Application
in	O
a	O
chain	O
is	O
not	O
contained	O
within	O
the	O
X-Forwarded-For	B-Protocol
field	O
,	O
it	O
is	O
in	O
the	O
actual	O
IP	O
header	O
.	O
</s>
<s>
A	O
web	B-Application
server	I-Application
should	O
log	O
both	O
the	O
request	O
's	O
source	O
IP	B-Protocol
address	I-Protocol
and	O
the	O
X-Forwarded-For	B-Protocol
field	O
information	O
for	O
completeness	O
.	O
</s>
<s>
standardized	O
a	O
Forwarded	O
HTTP	B-Protocol
header	I-Protocol
with	O
similar	O
purpose	O
but	O
more	O
features	O
compared	O
to	O
the	O
X-Forwarded-For	B-Protocol
HTTP	B-Protocol
header	I-Protocol
.	O
</s>
<s>
HAProxy	B-Language
defines	O
the	O
PROXY	B-Application
protocol	O
which	O
can	O
communicate	O
the	O
originating	O
client	O
's	O
IP	B-Protocol
address	I-Protocol
without	O
using	O
the	O
X-Forwarded-For	B-Protocol
or	O
Forwarded	O
header	O
.	O
</s>
<s>
This	O
protocol	O
can	O
be	O
used	O
on	O
multiple	O
transport	O
protocols	O
and	O
does	O
not	O
require	O
inspecting	O
the	O
inner	O
protocol	O
,	O
so	O
it	O
is	O
not	O
limited	O
to	O
HTTP	B-Protocol
.	I-Protocol
</s>
