Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 665 Bytes

real-ip-behind-loadbalancer.md

File metadata and controls

13 lines (9 loc) · 665 Bytes

Getting the real IP of the client behind a load balancer

If you use this container behind a proxy or load balancer you might want to get the real IP of the client instead of the IP of the proxy or load balancer.

To do this you can add the following configuration to the Nginx configuration:

set_real_ip_from <CIDR>

real_ip_header X-Forwarded-For;
real_ip_recursive on;

Where <CIDR> is the CIDR of your proxy or load balancer, see the Nginx documentation. The real IP of the client will now be available in PHP under $_SERVER['REMOTE_ADDR'].