Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Proper IP Address and Hostname on Log

    LAMP
    2
    4
    156
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • nj
      nj last edited by

      Below is a sample log from LAMP app. Notice the IP address, which should have been the remote IP of the user-agent. Also when the app is configured to have multiple hostnames (aliases), there's no way to distinguish which service received the request. Please fix this. Thanks!

      May 10 23:22:23 172.18.0.1 - - [10/May/2021:17:37:23 +0000] "GET /path-redacted" HTTP/1.1" 301 1532 "-" "User-Agent redacted"
      May 10 23:22:25 172.18.0.1 - - [10/May/2021:17:37:25 +0000] "GET /path-redacted" HTTP/1.1" 301 532 "-" "Mozilla (CloudronHealth)"
      May 10 23:22:26 172.18.0.1 - - [10/May/2021:17:37:26 +0000] "GET /path-redacted" HTTP/1.1" 301 65332 "-" "User-Agent redacted"
      May 10 23:22:26 172.18.0.1 - - [10/May/2021:17:37:26 +0000] "GET /path-redacted" HTTP/1.1" 301 5932 "-" "User-Agent redacted"
      May 10 23:22:26 172.18.0.1 - - [10/May/2021:17:37:26 +0000] "GET /path-redacted" HTTP/1.1" 301 7532 "-" "User-Agent redacted"
      May 10 23:22:28 172.18.0.1 - - [10/May/2021:17:37:28 +0000] "GET /path-redacted" HTTP/1.1" 301 5032 "-" "User-Agent redacted"
      May 10 23:22:28 172.18.0.1 - - [10/May/2021:17:37:28 +0000] "GET /path-redacted" HTTP/1.1" 301 1532 "-" "User-Agent redacted"
      May 10 23:22:28 172.18.0.1 - - [10/May/2021:17:37:28 +0000] "GET /path-redacted" HTTP/1.1" 301 2532 "-" "User-Agent redacted"
      May 10 23:22:28 172.18.0.1 - - [10/May/2021:17:37:28 +0000] "GET /path-redacted" HTTP/1.1" 301 532 "-" "Mozilla (CloudronHealth)"
      May 10 23:22:30 172.18.0.1 - - [10/May/2021:17:37:30 +0000] "GET /path-redacted" HTTP/1.1" 301 1532 "-" "User-Agent redacted"
      May 10 23:22:41 172.18.0.1 - - [10/May/2021:17:37:41 +0000] "GET /path-redacted" HTTP/1.1" 301 1532 "-" "User-Agent redacted"
      

      Founder & OpenSource Lover. My Cloudron Apps

      girish 2 Replies Last reply Reply Quote 0
      • girish
        girish Staff @nj last edited by

        @nj Thanks for reporting, I see the same behavior. The LAMP app is supposed to have RPAF module which fixes the IP address but clearly it's not working. Investigating...

        1 Reply Last reply Reply Quote 0
        • girish
          girish Staff last edited by

          With the php below, I can confirm the app can see the real IP. It's just the logs:

          <?php
          print_r($_SERVER);
          print_r($_POST);
          print_r($_GET);
          print_r($_FILES);
          ?>
          
          1 Reply Last reply Reply Quote 0
          • girish
            girish Staff @nj last edited by

            @nj I have fixed this in the new package. However, it will work only for new installation. For existing install, you have to edit /app/data/apache/app.conf and add the following lines (You can add it after the DocumentRoot /app/data/public line):

                LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
                CustomLog "|/bin/cat" proxy
                ErrorLog "|/bin/cat"
            

            After that restart the app.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB