简体   繁体   中英

Obtaining client IP using self-hosted web API behind rackspace hosted load balancer

I have a load balanced API, using Microsoft self-hosted Web API and running over HTTPS behind a hosted Rackspace loadbalancer. The load balancer does not terminate HTTPS but forwards the HTTPS direct to the serving host. Ie the SSL certs sit on each server handling the request.

If I bypass the load balance I can correctly extract the client IP using request.Properties.ContainsKey(RemoteEndpointMessageProperty.Name).

If I go through the load balancer I don't get the client IP I get the IP of the load balancer.

I have been searching and trying various methods to obtain the actual client IP to no avail. I have looked through the properties lists of the request whilst debugging thinking there must be a reference to the original client IP somewhere. Again to no avail.

There doesn't seem much I change that would help using RackSpace Web manager for the load balancer.

Is it possible to extract the original client IP in this scenario, or is this information simply not there after traversing the load balancer?

Many Thanks in advance.

Simon

Using HTTPS that is not terminated by the hosted load balancer means that it cannot add anything into the encrypted stream. This means the load balancer cannot pass on the original IP to the web server itself.

I had the same problem with Amazon. Check the headers it sends over, it should include the header "X-Forwarded-For" which contains the client's IP address.

This might be helpful as well .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM