Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Orgin IP From Load Balancer

Is there a way to get the origin IP of the user from the HTTP load balancing w/ GCloud? We are currently using just Network Load Balancing, and are needing to move to a cross region balancer although we need to user's IP for compliance and logging.

Does it pass in a header or something along those lines?

Thanks ~Z

like image 896
keoir Avatar asked Feb 06 '16 20:02

keoir


People also ask

Does a load balancer have an IP address?

A public load balancer has a public IP address that is accessible from the internet. A private load balancer has an IP address from the hosting subnet, which is visible only within your VCN. You can configure multiple listeners for an IP address to load balance transport Layer 4 and Layer 7 (TCP and HTTP) traffic.

Does ALB preserve source IP?

CLBs and ALBs do not support source IP preserving.


1 Answers

The documentation (https://cloud.google.com/compute/docs/load-balancing/http/) says it's the first IP address of the X-Forwarded-For header.

  X-Forwarded-For: <client IP(s)>, <global forwarding rule external IP>
like image 195
Matt S. Avatar answered Nov 02 '22 20:11

Matt S.