How to have ispconfig website stats use the X-Forwarded-for field to get IP?

Discussion in 'ISPConfig 3 Priority Support' started by Christian COMMARMOND, May 26, 2025.

  1. Christian COMMARMOND

    Christian COMMARMOND New Member HowtoForge Supporter

    Hi,
    I cannot find an answer to this question.

    I use ISPConfig Version: 3.1.13. I created a new website behind a load balancer called 'pound'. But the stats shows all queries coming from the load balancer and not from the original IP.

    Is there a way to solve that?

    Thank you.
    Christian

    PS: From this version, can I run ispconfig_update.sh without risks (after a VM backup)? Is there a page to show what might go wrong?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Is this an Apache or Nginx web server?
     
  3. Christian COMMARMOND

    Christian COMMARMOND New Member HowtoForge Supporter

    Apache on Centos 7.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    I guess the best way is that you install and load Apache mod_remoteip.
     
  5. Christian COMMARMOND

    Christian COMMARMOND New Member HowtoForge Supporter

    Thank you for your fast answer.

    After some investigations, I found that, for Centos 7, we have to do:

    1: Modify the file httpd.conf:
    56 Include conf.modules.d/*.conf
    57 LoadModule remoteip_module modules/mod_remoteip.so <<<< Add this line​
    2: Modify file /etc/httpd/conf/sites-enabled/100-MONWEBSITE.vhost
    7 <VirtualHost *:80>
    8
    ...
    14 RemoteIPProxyProtocol On <<<<<< Add this line​
    But it doesn't work because: RemoteIPProxyProtocol is only available in httpd 2.4.31 and newer

    I have:
    httpd -v
    Server version: Apache/2.4.6 ()
    Server built: Oct 15 2024 09:45:50
    Which goes back to my Post scriptum... Is it save to update?

    regards
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    I don't think you need:

    RemoteIPProxyProtocol On

    ESpecially as all logs are created and split globally anyway, so you can not configure this for each vhost separately.
     
  7. Christian COMMARMOND

    Christian COMMARMOND New Member HowtoForge Supporter

    OK. I will let it for today, since the stats don't seem to be realtime. I will check tomorrow morning if something changed and I will come back to tell you if it worked.
    Thank you again for your help.

    regards
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, statistics get created nightly. But you can check the access.log of the website in real-time to see if the IP addresses are correct now. Statistics get generated based on the access.log file of the site.
     

Share This Page