feat(config): add HTTP/HTTPS proxy config for outbound NZB traffic#606
Merged
Conversation
Adds a top-level `network` config block (http_proxy / https_proxy / no_proxy) exposed via the UI and applied to every outbound HTTP client used for indexer search, NZB grabbing, Arrs (Radarr/Sonarr/Lidarr/ Readarr/Whisparr), SABnzbd fallback, and the NZBLNK resolver. Internal endpoints (RC server, self-loopback) keep direct connections. Replaces reliance on process-wide HTTP_PROXY / HTTPS_PROXY env vars, which leak into internal calls and are awkward to manage in Docker / Gluetun setups. Required by users (e.g. NZBHydra2 + indexers) that enforce IP consistency between search and grab. Implementation: - NetworkConfig struct + getters in internal/config/manager.go. - httpclient.WithProxyConfig + NewForExternal helpers in internal/httpclient (proxy.go, factory.go) backed by golang.org/x/net/http/httpproxy. No env-var consultation; config is authoritative. - Constructors for prowlarr.NewClient, sabnzbd.NewSABnzbdClient, nzblnk.NewResolver, and arrs/clients.NewManager now accept an *http.Client so proxy + timeout settings flow through. starr.Config Client field is injected for every arr. - API: "network" added to PATCH switch; GET serializes via embedded *config.Config. - Frontend: NetworkConfig type + NetworkConfigSection.tsx registered in the System group of ConfigurationPage.tsx. - Tests: proxy/no_proxy/empty unit tests plus a yaml round-trip test. Refs #593.
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.
Summary
Adds a top-level
networkconfig block (http_proxy,https_proxy,no_proxy) exposed via the UI and applied to every outbound HTTP client used for grabbing NZBs and talking to indexers / arrs. Internal endpoints (RC server, self-loopback) are unaffected.Closes the gap in #593 — env-var-only proxy routing is too coarse, leaks into internal calls, and is hard to manage in Docker / Gluetun stacks where indexers enforce IP consistency between search and grab.
What changed
Backend
NetworkConfigstruct (http_proxy/https_proxy/no_proxy) onconfig.Configwith yaml/mapstructure/json tags. Defaults to empty (no proxy).internal/httpclient/proxy.go+factory.go:WithProxyConfig(...)option andNewForExternal(net, timeout)helper. Backed bygolang.org/x/net/http/httpproxyso semantics matchHTTP_PROXY/HTTPS_PROXY/NO_PROXYenv vars but the config is authoritative (env is not consulted).*http.Client:prowlarr.NewClient(Stremio addon search + NZB download)sabnzbd.NewSABnzbdClient(fallback host)nzblnk.NewResolver(NZBKing / NZBIndex)arrs/clients.NewManager—starr.Config.Clientinjected for every Radarr / Sonarr / Lidarr / Readarr / Whisparr instance."network"added to the PATCH switch inconfig_handlers.go. GET serializes through the embedded*config.Config, no extra response struct needed (no secrets to mask).Frontend
NetworkConfigTS interface +ConfigResponse.network+ConfigUpdateRequest.network.NetworkConfigSection.tsxunder the System group with three inputs and a DaisyUI info alert describing scope and the hot-reload caveat.Tests
Known limitations
cfg.Networkon every request — proxy changes apply on the next outbound call.clients.Manager, importersabnzbdClient) are constructed once at startup. The UI alert tells the user to restart AltMount to apply new proxy settings to those. Wiringconfig.OnConfigChangeto rebind is a follow-up.Test plan
go build ./...cleango vet ./...cleango test ./internal/httpclient/... ./internal/config/... -race— all passbun run build(frontend) — production bundle generatedno_proxy, confirm bypass/api/config, RC server) do not route through the proxy