From bc452cb48aad05213c2500933e0fe08f70607a6c Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Wed, 2 Sep 2026 11:24:54 -0500 Subject: [PATCH 1/2] fix(nginx): return JSON errors for unmatched api/feed/backup paths A bare or malformed /api, /feed, or /backup path fell through to the try_files directory handler and got an HTML 301/404, which breaks JSON API clients (they fail parsing with 'invalid character <'). Add location blocks that return a 404 JSON body for those unmatched paths so clients always get JSON. Valid //api/... routes are matched earlier and are unaffected. --- root/etc/nginx/template.conf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/root/etc/nginx/template.conf b/root/etc/nginx/template.conf index 8b9b788..5786671 100644 --- a/root/etc/nginx/template.conf +++ b/root/etc/nginx/template.conf @@ -153,6 +153,23 @@ http { fastcgi_index index.php; } + location = /api { + default_type application/json; + return 404 '{"error":"not found"}'; + } + location = /feed { + default_type application/json; + return 404 '{"error":"not found"}'; + } + location = /backup { + default_type application/json; + return 404 '{"error":"not found"}'; + } + location ~ ^.*\/(?:api|feed|backup)(?:$|\/) { + default_type application/json; + return 404 '{"error":"not found"}'; + } + # Health check location /health { return 200 'healthy'; From de4c05044a3c6feeecffab91609586d6d326ec85 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Sat, 17 Oct 2026 13:25:26 -0500 Subject: [PATCH 2/2] fix(nginx): match app error format for unmatched routes Co-Authored-By: Claude Sonnet 5.5 --- root/etc/nginx/template.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/root/etc/nginx/template.conf b/root/etc/nginx/template.conf index 5786671..6cae853 100644 --- a/root/etc/nginx/template.conf +++ b/root/etc/nginx/template.conf @@ -155,19 +155,19 @@ http { location = /api { default_type application/json; - return 404 '{"error":"not found"}'; + return 404 '{"error":"Starr Proxy: Invalid starr route"}'; } location = /feed { default_type application/json; - return 404 '{"error":"not found"}'; + return 404 '{"error":"Starr Proxy: Invalid starr route"}'; } location = /backup { default_type application/json; - return 404 '{"error":"not found"}'; + return 404 '{"error":"Starr Proxy: Invalid starr route"}'; } location ~ ^.*\/(?:api|feed|backup)(?:$|\/) { default_type application/json; - return 404 '{"error":"not found"}'; + return 404 '{"error":"Starr Proxy: Invalid starr route"}'; } # Health check