• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

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