1

My question is similar to the one asked here, but pertains specifically to non-standard request headers.

If my server is expecting non-standard request headers (like say X-Forwarded-For), how will the browser know it's supposed to send it?

user3264341
  • 89
  • 1
  • 8

1 Answers1

2

X-Forwarded-For is added when the request come into a proxy server or load-balancer that hides the main server address behind that. Also some of those headers are required by some specific servers and the clients must send the data over headers, such as x-api-key or some other names which are defined at the servers.

vhthanh
  • 209
  • 2
  • 6
  • Oh so you're saying that the original request from the browser didn't have `X-Forwarded-For`, but the proxy or load balancer added it? – user3264341 Nov 16 '21 at 15:34
  • Yes, it is. When it come through multiple proxy server or load-balancers, multiple IP should be added like X-Forwarded-For: browser-client-address, first-proxy, second-proxy-address, load-balancer-address – vhthanh Nov 16 '21 at 15:39
  • You can check the headers of a request from browser (which the browser client actually sends) and the headers that you receive at the server (modified headers request) to see the difference. – vhthanh Nov 16 '21 at 15:45