Load Balancer IP in remote_addr.

Matthew_K

Active Member
#1
Hi, I'm having an issue with getting the client IP because the load balancer is forwarding its own IP.

I have a LiteSpeed LB and 2 Litespeed WS.

What is the correct way to get the IP from the client? Is there a transparent way, or does the load balancer have to forward it some how?


Thanks,

Matt.
 

mistwang

LiteSpeed Staff
#4
I think I got it as "HTTP_X_FORWARDED_FOR" but is that just as accurate?
Its value is the remote IP : port that LB saw. If "X-Forwarded-For" exist in the request that LB receives, LB will append remote IP to it. You can use the last address listed if you want.

If you set the option in my previous post, LSWS will set "REMOTE_ADDR" to the first IP listed in "X-Forwarded-For" header.
 
Top