attempting to configure remoteip to log real visitor IPs in apache logs from proxy

Discussion in 'ISPConfig 3 Priority Support' started by ronee, Jul 2, 2018.

  1. ronee

    ronee Member HowtoForge Supporter

    Running ISPConfig 3.1 on debian 9
    I've enabled mod_remoteip, verified the module is loaded and created remoteip.conf in /etc/apache2/conf-available/ containing:
    RemoteIPHeader X_FORWARDED_FOR
    RemoteIPTrustedProxy <IP OF PROXY>

    Attempting to then obtain the forwarded IP in the apache logs by modifying the LogFormat directive.
    Have tried manually changing ispconfig.conf file LogFormat line to:

    LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig

    That resulted in the log entries going into the other_vhosts access log but still no real IP logged from the proxy.
    I also tried adding the above in the apache directives area for the site in ispconfig, log entries went to the usual vhosts logfile but still not seeing the forwarded (real) IPs from the proxy.

    Also tried modifying the LogFormat statement in apache2.conf.

    Would be interested in any suggestions on this.

    Thanks!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The log format must start with %v. Your log format cannot work as it is not compatible with vlogger which requires the first part to be the vhost which it uses to split the log for the different websites.
     
  3. ronee

    ronee Member HowtoForge Supporter

    in that case can we:

    1) add the IP from the proxy/load balancer into the log line somewhere maintaining %v in the beginning

    2) live with all logs from all sites logging to the same file
    ?

    Any recommendations?
    We have need often of a load balancer or proxy as a front end.
    Thanks
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Try it out.
     
  5. ronee

    ronee Member HowtoForge Supporter

    for ispconfig setups would it be correct to modify the LogFormat line in /etc/apache2/apache2.conf?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    No, the log format definition is in the ispconfig.conf file.
     
  7. ronee

    ronee Member HowtoForge Supporter

    ok thanks will give it a go
     

Share This Page