It is true that a load balancer will typically forward requests with its own IP address to the servers behind it, and the client's IP in an X-Forwarded-For
header. However, the Elastic Load Balancer seems a bit more transparent than that. I don't know what programming language you're using, but in my Java/Spring environment I get by just fine with a call to getRemoteAddr()
on my HttpServletRequest
. In other words, I don't think you need to bother with the X-Forwarded-For
header at all.
Good Luck!