Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

HTTP_X_FORWARDED_FOR only pass the real client ip if the load balancer is Global [Cloud run]

Hello

I have been performing some tests and I saw that only when I choose Global LoadBalance HTTPs does my application receive the correct ip address from HTTP_X_FORWARDED_FOR header from request, but when I choose LoadBalance REGIONAL or LoadBalance Global Classic the header get the 0.0.0.0 behind the LB.

Am I correct based on test results in this assumption?image.png

0 1 2,256
1 REPLY 1

Hi @amarboro ,

In general, the HTTP_X_FORWARDED_FOR header is used to identify the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer. The value of the header can vary depending on the specific implementation of the proxy or load balancer, so the behavior you are seeing with different types of load balancing may be due to differences in how the HTTP_X_FORWARDED_FOR header is handled.