• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Plesk Panel X-Forwarded-For

Chris Lemmer

New Pleskian
Hi there,

In front of my Plesk server, I have an apache reverse proxy. So I've had to modify the config files of my vhosts to log the correct X-Forwarded-For IP. I this this by modifying the following file as follows:

File: /usr/local/psa/admin/conf/templates/custom/domain/domainVirtualHost.php

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"[XF %{X-Forwarded-For}i]" proxy
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
CustomLog "<?php echo $VAR->domain->physicalHosting->logsDir ?>/<?php echo $OPT['ssl'] ? 'access_ssl_log' : 'access_log' ?>" combined env=!forwarded
CustomLog "<?php echo $VAR->domain->physicalHosting->logsDir ?>/<?php echo $OPT['ssl'] ? 'access_ssl_log' : 'access_log' ?>" proxy env=forwarded

Now, this works very nicely and each vhost generated by this file , logs correctly. However, I'm still struggling to get the actual Plesk panel to log correctly as well. When I tail the actual Plesk log, it still looks like this:

tail -f /usr/local/psa/admin/logs/httpsd_access_log

192.168.1.3 - - [02/Feb/2017:10:12:56 +0200] "GET /javascript/jsw.min.js?1485827310 HTTP/1.1" 304 0 "https://plesk-host01.mydomain.xx.xx...url=https://plesk-host01.mydomain.xx.xx:8443/" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1" "41.13.86.76"'/javascript/jsw.min.js' '' '/usr/local/psa/admin/htdocs

In my case, 192.168.1.3 is the IP of my reverse proxy. So my question is, what config file should I modify in order to make it show the X-forwarded-For IP as above?

Thanks
Chris
 
Back
Top