Score:0

Who sets the X-Forwarded-For hader?

us flag

Let's say I make an https GET request to a webserver with curl without specifying any headers.

On the webserver, I see the incoming request has a X-Forwarded-For (XFF) header set. Given that I did not set that header, who set it?

My guess is that my ISP intercepts my request and adds that header to my request. Then, additional links (switches, routers, etc.) on the way to the webserver add their own IP to the XFF header.

Is this correct? Assuming yes, what happens if I set the XFF header in my request? Will the ISP override that header or will it append its IP to that header?

tilleyc avatar
us flag
https://en.m.wikipedia.org/wiki/X-Forwarded-For You can really only guess at who is setting this header, as your request could go through load balancer or proxies at any point between you and a destination.
bkr879 avatar
us flag
I see. How do server frameworks determine the RemoteAddr of a request, then? I believe such a field is offered at least on PHP and Go servers. Do those frameworks also look at the XFF header or not?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.