themactep.com

A home of miscellaneous projects by Paul Philippov.

Notes

How to log visitor’s original IP when Apache is behind a proxy

sudo -s
a2enmod remoteip

echo '
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 192.168.1.71/20
RemoteIPTrustedProxy 2803:f800::/32
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
' > /etc/apache2/conf-available/remoteip.conf

a2enconf remoteip
systemctl restart apache2.service
exit