Commit Graph
1 Commits
Author SHA1 Message Date
yetone a690d8d7a1 main: magpie web behind a reverse proxy prints its link through the proxy, key and all (#1479, uclort)
magpie web on a server, listening on 127.0.0.1:3430 behind nginx or
Caddy, printed only http://127.0.0.1:3430/?k=…, and the reporter had to
join "/?k=…" onto their domain by hand. It now also prints
"through your proxy https://magpie.example.com/?k=…" when it is told
the proxy's address: MAGPIE_WEB_URL (the page's own address there), or
else MAGPIE_PUBLIC_URL with no port of its own, which NetworkLinks
already takes as a reverse proxy for --lan (#372). A MAGPIE_WEB_URL with
a query, a fragment, credentials or another scheme is ignored.

Only the printed link changes: the key, its cookie and webGuard are as
they were, and nothing new is listened on. The key itself was already
fixed with MAGPIE_WEB_KEY (16+ letters, digits, - . _ ~); the usage text
and docs/reference.md say both.

Run: go test -tags nogui -run TestWebProxyLink . (red with proxyLink
returning ""); a built magpie web under a sandbox HOME with
MAGPIE_WEB_URL=https://magpie.example.com, MAGPIE_WEB_KEY set, on
127.0.0.1:3493 printed the proxy line, answered 401 with no key and 303
with the key under Host: magpie.example.com.
2026-10-10 18:31:32 +08:00