- Server operating system version
- ubuntu 22.04
- Plesk version and microupdate number
- 18.0.65
I've got a Plesk server sitting behind a Ngnix Proxy Manager.
I am receiving correct HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP from the ngnix proxy on requests forwarded to domains on the Plesk server. Here's my topology:
However, I can't figure out how to get the Apache log files to show the HTTP_X_REAL_IP address in the log entries instead of the IP address of the proxy server.
For example when I access a test script on one of my domains on 192.168.2.90 I see an access_ssl_log entry like:
Unfortunately 192.168.2.2 is the IP address of my nginx proxy manager rather than the external IP address of the client.
I've got the 'remoteip' module enabled under Tools & Settings => Apache Web Server Settings
For the domain in question I've added the following directive to Websites & Domains => Apache and nginx Settings for mydomain.com=> Additional directives for HTTP & HTTPS:
shows that the module is already active.
I also tried changing the apache log format following these direction. I adjusted %a to be ${c}a as per Apache Module mod_log_config but that didn't seem to make any difference either. Either set to %a or %{c}a both end up showing 192.168.2.2
So to recap: My test scripts on the domain in question can recover the correct values from HTTP_X_REAL_IP, I just can't figure out how to get the correct remote IP address into the apache log files.
Thank you in advance for any help you might be able to provide.
I am receiving correct HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP from the ngnix proxy on requests forwarded to domains on the Plesk server. Here's my topology:
However, I can't figure out how to get the Apache log files to show the HTTP_X_REAL_IP address in the log entries instead of the IP address of the proxy server.
For example when I access a test script on one of my domains on 192.168.2.90 I see an access_ssl_log entry like:
Code:
192.168.2.2 - - [30/Nov/2024:13:03:58 -0800] "GET /test.php HTTP/1.1" 200 5128 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
Unfortunately 192.168.2.2 is the IP address of my nginx proxy manager rather than the external IP address of the client.
I've got the 'remoteip' module enabled under Tools & Settings => Apache Web Server Settings
For the domain in question I've added the following directive to Websites & Domains => Apache and nginx Settings for mydomain.com=> Additional directives for HTTP & HTTPS:
Code:
RemoteIPHeader X-Forwarded-For
Code:
a2enmod remoteip
I also tried changing the apache log format following these direction. I adjusted %a to be ${c}a as per Apache Module mod_log_config but that didn't seem to make any difference either. Either set to %a or %{c}a both end up showing 192.168.2.2
So to recap: My test scripts on the domain in question can recover the correct values from HTTP_X_REAL_IP, I just can't figure out how to get the correct remote IP address into the apache log files.
Thank you in advance for any help you might be able to provide.