Closed nealhead closed 1 month ago
Thank you for the report. Regrettably I'm not an expert in reverse proxies so I would rely someone else to help me fix this. Maybe you could help out with a PR too 🙏?
Also a question, did you check these community-sourced docs? https://github.com/jokob-sk/NetAlertX/blob/main/docs/REVERSE_PROXY.md
no reply for 2 weeks -> closing for now
Is there an existing issue for this?
Current Behavior
When editing a device for example, you can select a drop down menu to choose Device Type under details but when using Nginx Proxy Manager the drop downs do not populate. Screenshot below:
Before I post the app.conf... I think it may be related to these errors in the debug console on firefox. It would appear I am receiving 403 errors when loading the page.
XHRGET https://netalert.local/php/server/dbHelper.php?action=read&rawSql=WITH RECURSIVE SettingsIcons AS (SELECT REPLACE(REPLACE(REPLACE(Value, '[', ''), ']', ''), '''', '') AS icon_list FROM Settings WHERE Code_Name = 'UI_ICONS'), SplitIcons AS (SELECT TRIM(SUBSTR(icon_list, 1, INSTR(icon_list || ',', ',') - 1)) AS icon, SUBSTR(icon_list, INSTR(icon_list || ',', ',') + 1) AS remaining_icons FROM SettingsIcons WHERE icon_list <> '' UNION ALL SELECT TRIM(SUBSTR(remaining_icons, 1, INSTR(remaining_icons || ',', ',') - 1)) AS icon, SUBSTR(remaining_icons, INSTR(remaining_icons || ',', ',') + 1) AS remaining_icons FROM SplitIcons WHERE remaining_icons <> '') SELECT DISTINCT * FROM (SELECT icon as name, icon as id FROM SplitIcons UNION SELECT '❌None' AS name, '' AS id UNION SELECT Dev_Icon AS name, Dev_Icon AS id FROM Devices WHERE Dev_Icon <> '') AS combined_results; [HTTP/2 403 0ms]
XHRGET https://netalert.local/php/server/dbHelper.php?action=read&rawSql=SELECT DISTINCT 9 as ord, dev_DeviceType as id, dev_DeviceType as name FROM Devices WHERE dev_DeviceType NOT IN ('', 'Smartphone', 'Tablet', 'Laptop', 'Mini PC', 'PC', 'Printer', 'Server', 'Singleboard Computer (SBC)', 'NAS', 'Domotic', 'IP Camera', 'Game Console', 'SmartTV', 'TV Decoder', 'Virtual Assistance', 'Clock', 'House Appliance', 'Phone', 'Radio', 'AP', 'Gateway', 'Firewall', 'Hypervisor', 'Powerline', 'Switch', 'WLAN', 'PLC', 'Router', 'USB LAN Adapter', 'USB WIFI Adapter') UNION SELECT 0 as ord, '', '❌None' UNION SELECT 1 as ord, '-----', '-- 📱Handhelds --' UNION SELECT 1 as ord, 'Smartphone', 'Smartphone' UNION SELECT 1 as ord, 'Tablet', 'Tablet' UNION SELECT 2 as ord, '-----', '-- 💻Computers --' UNION SELECT 2 as ord, 'Laptop', 'Laptop' UNION SELECT 2 as ord, 'Mini PC', 'Mini PC' UNION SELECT 2 as ord, 'PC', 'PC' UNION SELECT 2 as ord, 'Printer', 'Printer' UNION SELECT 2 as ord, 'Server', 'Server' UNION SELECT 2 as ord, 'Singleboard Computer (SBC)', 'Singleboard Computer (SBC)' UNION SELECT 2 as ord, 'NAS', 'NAS' UNION SELECT 3 as ord, '-----', '-- 🏠Smart home --' UNION SELECT 3 as ord, 'Domotic', 'Domotic' UNION SELECT 3 as ord, 'IP Camera', 'IP Camera' UNION SELECT 3 as ord, 'Game Console', 'Game Console' UNION SELECT 3 as ord, 'SmartTV', 'SmartTV' UNION SELECT 3 as ord, 'TV Decoder', 'TV Decoder' UNION SELECT 3 as ord, 'Virtual Assistance', 'Virtual Assistance' UNION SELECT 4 as ord, '-----', '-- Wired --' UNION SELECT 4 as ord, 'Clock', 'Clock' UNION SELECT 4 as ord, 'House Appliance', 'House Appliance' UNION SELECT 4 as ord, 'Phone', 'Phone' UNION SELECT 4 as ord, 'Radio', 'Radio' UNION SELECT 5 as ord, '-----', '-- 📡Network nodes --' UNION SELECT 5 as ord, 'AP', 'AP' UNION SELECT 5 as ord, 'Gateway', 'Gateway' UNION SELECT 5 as ord, 'Firewall', 'Firewall' UNION SELECT 5 as ord, 'Hypervisor', 'Hypervisor' UNION SELECT 5 as ord, 'Powerline', 'Powerline' UNION SELECT 5 as ord, 'Switch', 'Switch' UNION SELECT 5 as ord, 'WLAN', 'WLAN' UNION SELECT 5 as ord, 'PLC', 'PLC' UNION SELECT 5 as ord, 'Router', 'Router' UNION SELECT 5 as ord, 'USB LAN Adapter', 'USB LAN Adapter' UNION SELECT 5 as ord, 'USB WIFI Adapter', 'USB WIFI Adapter' UNION SELECT 9 as ord, '-----', '-- ⚙Custom --' UNION SELECT 10 as ord, '-----', '-----' UNION SELECT 10 as ord, 'Other', 'Other' ORDER BY 1,2; [HTTP/2 403 0ms]
XHRGET https://netalert.local/php/server/dbHelper.php?action=read&rawSql=SELECT DISTINCT '' as id, '❌None' as name UNION SELECT dev_Owner as id, dev_Owner as name FROM (SELECT dev_Owner FROM Devices UNION SELECT 'House' ) AS all_devices ORDER BY id; [HTTP/2 403 0ms]
XHRGET https://netalert.local/php/server/dbHelper.php?action=read&rawSql=SELECT DISTINCT '' as id, '❌None' as name UNION SELECT dev_Group as id, dev_Group as name FROM (SELECT dev_Group FROM Devices WHERE dev_Group <> '' UNION SELECT 'Personal' UNION SELECT 'Always on' UNION SELECT 'Friends' UNION SELECT 'Others' ) AS all_devices ORDER BY id; [HTTP/2 403 1ms]
XHRGET https://netalert.local/php/server/dbHelper.php?action=read&rawSql=SELECT DISTINCT '' as id, '❌None' as name UNION SELECT dev_Location as id, dev_Location as name FROM (SELECT dev_Location FROM Devices where dev_Location not in (null, 'null', '') UNION SELECT 'Bathroom' UNION SELECT 'Bedroom' UNION SELECT 'Dining room' UNION SELECT 'Hall' UNION SELECT 'Kitchen' UNION SELECT 'Laundry' UNION SELECT 'Living room' UNION SELECT 'Study' UNION SELECT 'Attic' UNION SELECT 'Basement' UNION SELECT 'Garage' UNION SELECT 'Back yard' UNION SELECT 'Garden' UNION SELECT 'Terrace') AS all_devices ORDER BY id; [HTTP/2 403 1ms]
XHRGET https://netalert.local/php/server/dbHelper.php?action=read&rawSql=SELECT '❌None' as name, '' as id UNION SELECT Dev_Name as name, dev_MAC as id FROM Devices WHERE EXISTS (SELECT 1 FROM Settings WHERE Code_Name = 'NETWORK_DEVICE_TYPES' AND LOWER(value) LIKE '%' || LOWER(dev_DeviceType) || '%' AND dev_DeviceType <> '') [HTTP/2 403 1ms]
Expected Behavior
When NOT using a reverse proxy, the drop downs work as expected and have selectable options
Steps To Reproduce
1) Put NetAlertX behind a reverse proxy, in my case Nginx Proxy Manager 2) Open device details 3) Choose field with drop down
app.conf
docker-compose.yml
What branch are you running?
Production
app.log
21:15:33 [ARP Scan] Found: Devices without duplicates 41 21:15:33 [Plugins] SUCCESS, received 43 entries 21:15:34 [API] Updating table_appevents.json file in /front/api 21:15:34 [API] Updating table_plugins_history.json file in /front/api 21:15:34 [API] Updating table_plugins_objects.json file in /front/api 21:15:34 [Plugin utils] --------------------------------------------- 21:15:34 [Plugin utils] display_name: Internet-Check 21:15:34 [Plugins] Executing: python3 /app/front/plugins/internet_ip/script.py prev_ip={prev_ip} INTRNT_DIG_GET_IP_ARG={INTRNT_DIG_GET_IP_ARG} 21:15:34 [INTRNT] In script 21:15:34 [INTRNT] INTRNT_DIG_GET_IP_ARG: -4 myip.opendns.com @resolver1.opendns.com 21:15:34 [INTRNT] - Retrieving Internet IP 21:15:34 [INTRNT] DIG result : 0.0.0.0
21:15:34 [INTRNT] Current internet_IP : 0.0.0.0 21:15:34 [INTRNT] previous_IP : 0.0.0.0 21:15:34 [Plugins] SUCCESS, received 1 entries 21:15:34 [API] Updating table_appevents.json file in /front/api 21:15:34 [API] Updating table_plugins_history.json file in /front/api 21:15:34 [Process Scan] Processing scan results 21:15:34 [Process Scan] Print Stats 21:15:34 [Scan Stats] Devices Detected.......: 45 21:15:34 [Scan Stats] New Devices............: 0 21:15:34 [Scan Stats] Down Alerts............: 0 21:15:34 [Scan Stats] New Down Alerts........: 0 21:15:34 [Scan Stats] New Connections........: 9 21:15:34 [Scan Stats] Disconnections.........: 1 21:15:34 [Scan Stats] IP Changes.............: 2 21:15:34 [Scan Stats] Scan Method Statistics: 21:15:34 INTRNT: 1 21:15:34 arp-scan: 43 21:15:34 local_MAC: 1 21:15:34 [Process Scan] Stats end 21:15:34 [Process Scan] Sessions Events (connect / discconnect) 21:15:34 [Process Scan] Creating new devices 21:15:34 [Process Scan] Updating Devices Info 21:15:34 [Process Scan] Voiding false (ghost) disconnections 21:15:34 [Process Scan] Pairing session events (connection / disconnection) 21:15:34 [Process Scan] Creating sessions snapshot 21:15:34 [Process Scan] Inserting scan results into Online_History 21:15:34 [Process Scan] Skipping repeated notifications 21:15:34 [Skip Repeated Notifications] Skip Repeated 21:15:34 [Plugin utils] --------------------------------------------- 21:15:34 [Plugin utils] display_name: NSLOOKUP (Name discovery) 21:15:34 [Plugins] Executing: python3 /app/front/plugins/nslookup_scan/nslookup.py 21:15:34 [NSLOOKUP] In script 21:15:34 [Database] Opening DB 21:15:34 [NSLOOKUP] Unknown devices count: 4 21:15:35 [NSLOOKUP]No PTR record found for IP: 192.168.2.21 21:15:35 [NSLOOKUP]No PTR record found for IP: 192.168.2.24 21:15:35 [NSLOOKUP]No PTR record found for IP: 192.168.2.29 21:15:35 [NSLOOKUP]No PTR record found for IP: 192.168.1.239 21:15:35 [NSLOOKUP] Script finished 21:15:35 [Plugins] No output received from the plugin NSLOOKUP - enable LOG_LEVEL=debug and check logs 21:15:35 [Update Device Name] Trying to resolve devices without name. Unknown devices count: 4 21:15:35 [Update Device Name] Pholus entries from prev scans: 52 21:15:35 [Update Device Name] Names Found (DiG/NSLOOKUP/NBTSCAN/Pholus): 0 (0/0/0/0) 21:15:35 [Update Device Name] Names Not Found : 4 21:15:35 [Notification] Check if something to report 21:15:35 [Notification] Included sections: ['new_devices'] 21:15:35 [Notification] No changes to report 21:15:35 [MAIN] Process: Wait 21:15:40 [API] Updating table_appevents.json file in /front/api 21:15:40 [API] Updating table_devices.json file in /front/api 21:15:40 [API] Updating table_events_pending_alert.json file in /front/api 21:15:40 [API] Updating table_custom_endpoint.json file in /front/api 21:16:15 [Plugin utils] --------------------------------------------- 21:16:15 [Plugin utils] display_name: NSLOOKUP (Name discovery) 21:16:15 [Plugins] Executing: python3 /app/front/plugins/nslookup_scan/nslookup.py 21:16:15 [NSLOOKUP] In script 21:16:15 [Database] Opening DB 21:16:15 [NSLOOKUP] Unknown devices count: 4 21:16:16 [NSLOOKUP]No PTR record found for IP: 192.168.2.21 21:16:16 [NSLOOKUP]No PTR record found for IP: 192.168.2.24 21:16:16 [NSLOOKUP]No PTR record found for IP: 192.168.2.29 21:16:16 [NSLOOKUP]No PTR record found for IP: 192.168.1.239 21:16:16 [NSLOOKUP] Script finished 21:16:16 [Plugins] No output received from the plugin NSLOOKUP - enable LOG_LEVEL=debug and check logs 21:16:16 [Update Device Name] Trying to resolve devices without name. Unknown devices count: 4 21:16:16 [Update Device Name] Pholus entries from prev scans: 52 21:16:16 [Update Device Name] Names Found (DiG/NSLOOKUP/NBTSCAN/Pholus): 0 (0/0/0/0) 21:16:16 [Update Device Name] Names Not Found : 4 21:16:16 [Notification] Check if something to report 21:16:16 [Notification] Included sections: ['new_devices'] 21:16:16 [Notification] No changes to report 21:16:16 [MAIN] Process: Wait 21:17:16 [Plugin utils] --------------------------------------------- 21:17:16 [Plugin utils] display_name: NSLOOKUP (Name discovery) 21:17:16 [Plugins] Executing: python3 /app/front/plugins/nslookup_scan/nslookup.py 21:17:17 [NSLOOKUP] In script 21:17:17 [Database] Opening DB 21:17:17 [NSLOOKUP] Unknown devices count: 4 21:17:17 [NSLOOKUP]No PTR record found for IP: 192.168.2.21 21:17:17 [NSLOOKUP]No PTR record found for IP: 192.168.2.24 21:17:17 [NSLOOKUP]No PTR record found for IP: 192.168.2.29 21:17:17 [NSLOOKUP]No PTR record found for IP: 192.168.1.239 21:17:17 [NSLOOKUP] Script finished 21:17:17 [Plugins] No output received from the plugin NSLOOKUP - enable LOG_LEVEL=debug and check logs 21:17:17 [Update Device Name] Trying to resolve devices without name. Unknown devices count: 4 21:17:17 [Update Device Name] Pholus entries from prev scans: 52 21:17:17 [Update Device Name] Names Found (DiG/NSLOOKUP/NBTSCAN/Pholus): 0 (0/0/0/0) 21:17:17 [Update Device Name] Names Not Found : 4 21:17:17 [Notification] Check if something to report 21:17:17 [Notification] Included sections: ['new_devices'] 21:17:17 [Notification] No changes to report 21:17:17 [MAIN] Process: Wait 21:18:18 [Plugin utils] --------------------------------------------- 21:18:18 [Plugin utils] display_name: NSLOOKUP (Name discovery) 21:18:18 [Plugins] Executing: python3 /app/front/plugins/nslookup_scan/nslookup.py 21:18:18 [NSLOOKUP] In script 21:18:18 [Database] Opening DB 21:18:18 [NSLOOKUP] Unknown devices count: 4 21:18:18 [NSLOOKUP]No PTR record found for IP: 192.168.2.21 21:18:18 [NSLOOKUP]No PTR record found for IP: 192.168.2.24 21:18:18 [NSLOOKUP]No PTR record found for IP: 192.168.2.29 21:18:18 [NSLOOKUP]No PTR record found for IP: 192.168.1.239 21:18:18 [NSLOOKUP] Script finished 21:18:18 [Plugins] No output received from the plugin NSLOOKUP - enable LOG_LEVEL=debug and check logs 21:18:18 [Update Device Name] Trying to resolve devices without name. Unknown devices count: 4 21:18:18 [Update Device Name] Pholus entries from prev scans: 52 21:18:18 [Update Device Name] Names Found (DiG/NSLOOKUP/NBTSCAN/Pholus): 0 (0/0/0/0) 21:18:18 [Update Device Name] Names Not Found : 4 21:18:18 [Notification] Check if something to report 21:18:18 [Notification] Included sections: ['new_devices'] 21:18:18 [Notification] No changes to report 21:18:18 [MAIN] Process: Wait
Debug enabled