天天看点

Amazon ELB - Capturing Client IP Address

If you're using Amazon EC2'sElasticLoad Balancer(ELB)for load balancing web applications, you may have noticed that in your webaccess logs, the remote host IP address is the same for every request. The IPaddress you see is the private IP address of the load balancer.

If you want to see the IP address of the client (called remote host in accesslog documentation), you'll need to look at the value of theX-Forwarded-Forrequest header which ELB populateswhen it forwards the request.

This can be achieved in an Apache access log by using the syntax:

%{X-Forwarded-For}i      

You Apache log format would then look something like this:

下一篇: 点云技术

继续阅读