How to get real customer ip in google container engine and apache setup

7/27/2015

I can't find out customer real IP address when apache-php enviroment runs in google container. Without modifying anything, I get ip address from container address range, when using mod_remoteip, I can add

RemoteIPHeader X-Client-IP
RemoteIPInternalProxyList ournet/proxy-list

and add rows into "proxy-list"-file:

10.240.0.0/16 # google internal network
10.244.0.0/14 # Cluster aadress range

Only the row 10.244.0.0/14 gives any result. In this case I get the cluster node's ip as REMOTE_ADDR value from the 10.240.0.0/16 network.

It seems, that the node itself acts as forwarder, without adding needed headers to the request or I am looking it from totally wrong perspective?

-- Jüri Pruulmann
apache
google-kubernetes-engine
kubernetes

1 Answer

9/18/2015

Some traffic is masqueraded, but it is done at L3, rather than L7, so there's no way to add a header. :(

This will get better soon for in-cluster traffic, but we have to wait for cloud load-balancers to catch up before we can properly handle out-of-cluster traffic properly.

-- Tim Hockin
Source: StackOverflow