Files
magpie/docs
yetone a94468ea5e gui: a plugin page behind a proxy that keeps no Host still loads its scripts (xuanwo on X)
xuanwo's Day card was blank in magpie web behind a reverse proxy. The
frame's CSP named the page's folder under r.Host (https:// and http://),
and a proxy that keeps no Host (nginx's default proxy_pass) hands magpie
its upstream's own address, so the policy named nothing the browser used
and every script was blocked.

A browser's page now names its own origin in the frame's address
(_o=, framed() in pluginpages.js; the frame sends no Referer, its
referrerpolicy is no-referrer, so a Referer can't carry it), and
ownSources adds it (browserOrigin: http(s) only, no user info, a plain
host). The desktop window's scheme is unchanged.

Run, on mote:
- TestPluginPagePolicyBehindProxyHost: red on the old code (policy names
  only the upstream host), green now; also checks that a junk _o
  (javascript:, user info, a path) adds nothing.
- Real repro: a sandbox `magpie web` behind a Node proxy that rewrites Host
  to the upstream's, opened at http://localhost:3495/?view=plugin-day-card
  in Playwright chromium and webkit. Before: a broken frame (webkit
  screenshot 52KB, no card). After: the card draws in both, the frame's
  address carries ?_o=http%3A%2F%2Flocalhost%3A3495.
- go vet (darwin), GOOS=windows and GOOS=linux -tags nogui for internal/gui,
  usageapi; go test internal/plugin, internal/usageapi and internal/gui
  -run 'PluginPage|Page|Day'; plugin-page*.test.cjs in both engines: 8 of
  10 pass. The 2 reds are plugin-page-foreign-error ("own: the frame
  opened"), red on origin/main too before this change (#6117).

Not tried: nginx itself (a Node proxy that rewrites Host stands in), Cloudflare
Tunnel, and the desktop window on Windows. The whole GUI suite is started
after the tag.
2026-11-11 17:38:42 +08:00
..