Skip to content

fix(nginx): return JSON errors for unmatched api/feed/backup paths - #110

Open
bakerboy448 wants to merge 1 commit into
Notifiarr:developfrom
bakerboy448:claude/api-json-errors
Open

fix(nginx): return JSON errors for unmatched api/feed/backup paths#110
bakerboy448 wants to merge 1 commit into
Notifiarr:developfrom
bakerboy448:claude/api-json-errors

Conversation

@bakerboy448

Copy link
Copy Markdown
Contributor

Problem: a bare or malformed /api, /feed, or /backup path (no consumer prefix / no endpoint) falls through try_files $uri $uri/ and nginx returns an HTML 301 trailing-slash redirect (or default HTML 404). JSON API clients then fail with invalid character '<' instead of getting a parseable error. Hit in practice by arr automation repointed at starrproxy.

Fix: add location blocks that return 404 {"error":"not found"} with application/json for those unmatched api|feed|backup paths. Valid /<consumer>/api/... (and feed/backup) routes are matched by the earlier regex locations and are unaffected; /health, PHP, and static handling are unchanged.

nginx-only change; validated with git diff --check (no live nginx -t available in the authoring env).

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 /<consumer>/api/... routes are matched earlier and are unaffected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant