feat(seerr): Web/Container: Inject custom Seerr headers via nginx proxy#971
Open
v3DJG6GL wants to merge 34 commits intoDonutWare:developfrom
Open
feat(seerr): Web/Container: Inject custom Seerr headers via nginx proxy#971v3DJG6GL wants to merge 34 commits intoDonutWare:developfrom
v3DJG6GL wants to merge 34 commits intoDonutWare:developfrom
Conversation
…uble slash in proxy_pass
…ampering redirect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description
Currently, for the web/container version you can't configure global custom headers for Seerr.
There were already some attempts: PR #817 introduced
SEERR_HEADERfunctionality, but it got removed again with #833.This implementation had the flaw that the custom header was exposed to anyone with access to Fladder WebUI:
The
SEERR_HEADERENV value was written to/assets/config/config.json, which anyone with access to the Fladder WebUI can fetch.With my new attempt, the custom headers are now routed to Seerr through the nginx proxy that already serves the web build, so the headers get injected server-side and should never reach the browser.
How it should work
You set
SEERR_HEADERvia the docker ENV, e.g:{"Remote-User":"you","CF-Access-Client-Id":"abc"}.On startup,
docker-entrypoint.shruns it throughjqand turns each entry into aproxy_set_headerdirective inside alocation /seerr-proxy/block in the generated nginx config.The entrypoint also writes a new
seerrProxyPathfield intoassets/config/config.json. On web,SeerrRequestinlib/providers/seerr_api_provider.dartpicks that up and resolves requests against the proxy path instead of the raw Seerr URL.Mobile/Desktop builds don't touch
seerrProxyPathat all (guarded bykIsWeb) - they keep using the per-credentialcustomHeaderslike before.Example configuration (docker-compose)
Security model / intended use
SEERR_HEADERis intended for headers that authenticate the Fladder container to an outer auth layer in front of Seerr (e.g. Authelia, Authentik, forward-auth, Cloudflare Access, basic auth on a reverse proxy, etc.). Those headers let Fladder get past this out wall to reach Seerr.What
SEERR_HEADERis not for: Seerr's ownX-Api-Key. The/seerr-proxy/endpoint is not authenticated by Fladder - Fladder has no HTTP-layer auth at all. So a SeerrX-Api-Keyplaced here would let any HTTP caller on Fladder act as a Seerr admin (list users, create/modify/delete requests, change settings) - sth we don't really want ;)Untrusted inputs are validated and escaped: Both in the docker entrypoint (before generating the nginx config) and in the Flutter client (before resolving URLs). Malformed input fails with a clear error instead of silently producing a broken config.
Clean-Up (leftover from #833)
I found some dead configuration in
config.jsonwhich was introduced with #817 but was not removed by #833:config/config.json: removes the staleseerrHeader: nullfield. The schema parsing was already removed by chore: Remove seerrHeader from config.json #833.Issue Being Fixed
N/A
Screenshots / Recordings
N/A
Notes
AI Disclosure
Developed with assistance from Claude Code (Opus 4.7). The LLM helped me identify the related files, code parts and proposed possible code modifications and fixes.
I've manually reviewed, cleaned, refactored and hardened the code the best I could, but my Dart capabilities are not that good.
A Proper code review is required in any case - also especially since this PR is also focused on authentication...
Tested On
Checklist
jqis alpine-only and only added for docker/web builds, not for other desktop/mobile builds.