I am using apache as a proxy server to accept incoming requests on one port and redirect them out to the destination (based on the incoming port) on a different post, as an example of a VirtualHost entry:
<VirtualHost *:444>
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
ProxyRequests Off
ServerName mydomain.com
ServerAlias mydomain.com
ProxyPass / http://destination_IP:6444/
ProxyPassReverse / http://destination_IP:6444/
SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
My issue is that when the request reaches the destination server, it appears with my public IP address (the IP address of the apache proxy server), not the original client IP address.
I have tried enabling mod_remoteip
with a2enmod remoteip
and added the following into the apache2.conf file :
LoadModule remoteip_module modules/mod_remoteip.so
But I am not getting the client IP address forwarded over to the destination server, it still appears as my own (the proxy servers public IP address).
It is not possible for me to modify anything on the destination servers, so I need to resolve on my own proxy server.
How can I pass the clients IP address in this scenario?
Thank you.