Forward real ip from Nginx docker to Apache docker

Hi,

I have a Nginx container running as reverse proxy for some other docker containers. One of them has an apache server running and logs login attempts in web_php.log.

Right now I am getting the real ip-address in the nginx log and the docker gateway in my apache logs. Is it possible to forward the real ip to apache?

Nginx is running in network mode = host and my other containers running in bridged mode.

Thanks in advance!

Appart from running in docker, your question is not realy docker related. The same would happen if nginx would run on a bare metal machine and apache would be on the same or a different machine.

Typicaly people set the http headers X-Forwarded-For, X-Real-IP, X-Forwarded-Host, X-Forwarded-Proto in their reverse proxy. It is up to the target application to make use of those headers. Applications designed to work with reverse proxies usual do so.