Skip to content

404 Error on GET /api/config #124

@madushanTHAMB

Description

@madushanTHAMB

Issue: 404 Error on GET /api/config

Hello guys !

Description

I am encountering a 404 Not Found error when attempting to access /api/config on the frontend of the nfsen-ng web interface. The backend is functioning correctly, and I can successfully parse files, generate nfcapd files daily, and create RRD files without any issues. However, the frontend fails to retrieve the configuration from the /api/config endpoint.


Environment and Setup

OS and Web Server

  • OS: Arch Linux
  • Web Server: Apache (httpd)
  • PHP Version: 8.3

nfsen-ng Setup

  • Repository: Cloned into /data/nfsen-ng/
  • Frontend: Located in /data/nfsen-ng/frontend/
  • Backend: Located in /data/nfsen-ng/backend/
  • RRD Files: Located in /data/nfsen-ng/backend/datasources/data
  • NFCAPD Files: Generated in /data/nfsen-ng/profiles-data/

Current Configuration

Apache Configuration (httpd.conf)

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /data/nfsen-ng/frontend

    # Alias pour le frontend
    Alias /nfsen-ng/ /data/nfsen-ng/frontend/

    <Directory /data/nfsen-ng/frontend/>
        AllowOverride All
        Require all granted
    </Directory>

    # Configuration pour le backend (nécessaire pour les réécritures définies dans .htaccess)
    <Directory /data/nfsen-ng/backend/>
        AllowOverride All
        Require all granted
    </Directory>

    # Journaux personnalisés pour déboguer
    ErrorLog /var/log/httpd/nfsen-ng-error.log
    CustomLog /var/log/httpd/nfsen-ng-access.log combined

    # Définir le niveau des logs pour le débogage des réécritures
    LogLevel alert rewrite:trace3
</VirtualHost>

nfsen-ng Settings (settings.php):

<?php

$nfsen_config = [
    'general' => [
        'filters' => [
            'proto udp',
            'proto tcp',
        ],
        'formats' => [
            'external_interfaces' => '%ts %td %pr %in %out %sa %sp %da %dp %ipkt %ibyt %opkt %obyt %flg',
        ],
        'db' => 'RRD',
        'processor' => 'NfDump',
        'ports' => [],
        'stored_output_formats' => [],
        'stored_filters' => [],
        'sources' => [
            'PFC_CHA',
        ],        
    ],
    'frontend' => [
        'reload_interval' => 60,
        'defaults' => [
            'view' => 'graphs',
            'graphs' => [
                'display' => 'sources',
                'datatype' => 'flows',
                'protocols' => ['any'],
            ],
            'flows' => [
                'limit' => 50,
            ],
            'statistics' => [
                'order_by' => 'bytes',
            ],
            'table' => [
                'hidden_fields' => [
                    'flg', 'fwd', 'in', 'out', 'sas', 'das'
                ],
            ],
        ],
    ],
    'nfdump' => [
        'binary' => '/usr/local/bin/nfdump',
        'profiles-data' => '/data/nfsen-ng/profiles-data/',
        'profile' => 'live',
        'max-processes' => 10,
    ],
    'log' => [
        'priority' => \LOG_INFO,
    ],
];

Apache Modules - The following modules are enabled:

rewrite_module (shared)
deflate_module (shared)
expires_module (shared)
php_module (shared)

My nfcapd command:

/usr/local/bin/nfcapd -vv -D -p 9995 -B 20971520 -S 1 -P /data/nfsen-ng/var/run/p9995.pid -z=lz4 -t 300 -I PFC_CHA -w /data/nfsen-ng/profiles-data/live/PFC_CHA -T all

Frontend Error:

On the web interface, the /api/config endpoint returns a 404 Not Found.
The following error is observed in the browser console:
GET http://X.X.X.X/api/config 404 (Not Found)

It's been 2 days i'm on it and i can't find any solution in the issues, is it maybe because i'm not putting the files in /var/www/html ? I don't really know, so if you could help me i'll be great :)
Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions