• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

the API return 404 (or 501/302 when using /api/index.php?)

Scheduled Pinned Locked Moved Solved
FOG Problems
3
7
1.1k
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.
  • N
    Nono
    last edited by Sep 12, 2018, 12:58 PM

    I’m sorry for the double-posting, but after submitting my issue on github (https://github.com/FOGProject/fogproject/issues/263) I realized that it could have been a technical issue (even though, the installation of both, system + FOG is brand new).

    Basically, the API doesn’t seems to works correctly, the log are on the github, for for better reading/following, here is a copy/paste of my issue :


    Hi there,

    I’m currently unable to use the API as I constantly got either a 404 or 501/302 (using for instance, this command) :

    $ curl -H "fog-api-token: MjUwYjkxNGU4YTJkNjM3MDliNmVlZDFjZGE5YjcwNjg2N2Y1ZWE1NjMxMzFkZTk4Y2ZhOWZjNGJjZDUyZGIxNTljODg0NDhiM2RlODBmMzc5ZWFkMTkxxxxx1NDU5OTZhMzIwODJmYThiNWI0MzhhYjkwMDZhNzQ1MTFiNjg" -H "fog-user-token: NTQ5MWJiMjgxNmI5OTcyZDM5OTMzMWJlZjlkZWM4Y2M2MDg0ZTI5MTQ5MGZlYzdkNmYzY2NjNTc1OGE1ZGE3ODY4NDlkOWU4NjFiMzdmOTU5MDxxxN2NjNDQxYjhlMWI3MjYxZDMxZmRkZmNkY2M1Mjk4ZGNmZGUzMzNiNWY" -X GET http://192.168.6.128/fog/system/info
    
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>404 Not Found</title>
    </head><body>
    <h1>Not Found</h1>
    <p>The requested URL /fog/system/info was not found on this server.</p>
    <hr>
    <address>Apache/2.4.34 (Ubuntu) Server at 192.168.6.128 Port 80</address>
    </body></html>
    

    from apache “acces.log” ;

    "GET /fog/system/info HTTP/1.1" 404 453 "-" "curl/7.58.0"
    

    Using /api/index.php?system/info gave me a 501 :

    $ curl -H "fog-api-token: MjUwYjkxNGU4YTJkNjM3MDliNmVlZDFjZGE5YjcwNjg2N2Y1ZWE1NjMxMzFkZTk4Y2ZhOWZjNGJjZDUyZGIxNTljODg0NDhiM2RlODBmMzc5ZWFkMTkxxxxx1NDU5OTZhMzIwODJmYThiNWI0MzhhYjkwMDZhNzQ1MTFiNjg" -H "fog-user-token: NTQ5MWJiMjgxNmI5OTcyZDM5OTMzMWJlZjlkZWM4Y2M2MDg0ZTI5MTQ5MGZlYzdkNmYzY2NjNTc1OGE1ZGE3ODY4NDlkOWU4NjFiMzdmOTU5MDxxxN2NjNDQxYjhlMWI3MjYxZDMxZmRkZmNkY2M1Mjk4ZGNmZGUzMzNiNWY" -X GET http://192.168.6.128/fog/api/index.php?system/info
    

    Related access.log entry:

    "GET /fog/api/index.php?system/info HTTP/1.1" 501 678 "-" "curl/7.58.0"
    

    FYI; here is my (untouched) /etc/apache2/sites-enabled/001-fog.conf:

    <VirtualHost *:80>
        <FilesMatch "\.php$">
            SetHandler "proxy:fcgi://127.0.0.1:9000/"
        </FilesMatch>
        KeepAlive Off
        ServerName 192.168.2.1
        DocumentRoot /var/www/
        <Directory /var/www/fog/>
            DirectoryIndex index.php index.html index.htm
        </Directory>
        RewriteEngine On
        RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
        RewriteRule .* - [F]
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
        RewriteRule ^/fog/(.*)$ /fog/api/index.php [QSA,L]
    </VirtualHost>
    

    Could you please let me know what else should I check as there is no logs on /opt/fog/log/* related to the API.

    1 Reply Last reply Reply Quote 0
    • T
      Tom Elliott
      last edited by Sep 12, 2018, 2:10 PM

      Please check fog settings for fog_api_enabled

      I believe it is defaulted to disabled to ensure some small level of safety, as the default user/password is well known.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      N 2 Replies Last reply Sep 13, 2018, 6:56 AM Reply Quote 0
      • N
        Nono @Tom Elliott
        last edited by Sep 13, 2018, 6:56 AM

        Hi @Tom-Elliott,

        As far as I can see, everything looks normal/Activated :
        0_1536821674752_ed235326-0678-47c1-b8a3-29cbe10a993d-image.png

        0_1536821759911_79d03fa8-c4c2-4ae6-91c7-46ff52cd8e3b-image.png

        1 Reply Last reply Reply Quote 0
        • N
          Nono @Tom Elliott
          last edited by Sep 17, 2018, 8:38 AM

          Hi @Tom-Elliott ,

          I tried to disable / enable again : No luck
          I tried to reset both token : No luck.

          Any idea ?

          1 Reply Last reply Reply Quote 0
          • S
            Sebastian Roth Moderator
            last edited by Sep 23, 2018, 6:45 AM

            @Nono Sorry for the very long delay. Took me a while to find the time to look into this and figure it out. Seems like the default site apache config is somehow overwriting our 001-fog.conf and therefore the rewrite rules don’t kick in. Not sure if this is just on Ubuntu. Don’t have the time to try other distros as well but for now I assume this is specific for Ubuntu. Run this to fix the issue for now:

            a2dissite 000-default.conf
            service apache restart
            

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            N 1 Reply Last reply Sep 24, 2018, 9:03 AM Reply Quote 0
            • N
              Nono @Sebastian Roth
              last edited by Sep 24, 2018, 9:03 AM

              @Sebastian-Roth said in the API return 404 (or 501/302 when using /api/index.php?):

              @Nono Sorry for the very long delay. Took me a while to find the time to look into this and figure it out. Seems like the default site apache config is somehow overwriting our 001-fog.conf and therefore the rewrite rules don’t kick in. Not sure if this is just on Ubuntu. Don’t have the time to try other distros as well but for now I assume this is specific for Ubuntu. Run this to fix the issue for now:

              a2dissite 000-default.conf
              service apache2 restart
              

              Thanks @Sebastian-Roth,

              Expect the “apache2” instead of “apache”, it works much better !
              I’m going to update the github case as well.

              1 Reply Last reply Reply Quote 0
              • S
                Sebastian Roth Moderator
                last edited by Oct 28, 2018, 1:42 PM

                @Nono Marking this solved as well now as I finally found the root cause of it and added a fix to the installer (ref).

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post

                161

                Online

                12.0k

                Users

                17.3k

                Topics

                155.2k

                Posts
                Copyright © 2012-2024 FOG Project