Skip to content

Serve the board from a path behind a proxy - #102

Merged
emanuele-em merged 1 commit into
mainfrom
subpath-urls
Dec 3, 2026
Merged

emanuele-em merged 1 commit into
mainfrom
subpath-urls

Conversation

@emanuele-em

Copy link
Copy Markdown
Owner

Fixes #99

Behind a proxy that serves the board under a path, like location /kanzo/ { proxy_pass http://kanzo:4242/; }, the page asked for /app.js, /api/..., /sw.js and the rest at the proxy's root. Now the page, its service worker and the manifest ask for everything relative to where they were loaded, as @baron-hines proposed in #99. There's no new setting, and the server's routes don't change.

  • index.html: the icon, manifest, logo and script.
  • app.js: base() is . or ./remote, so API calls and images go to ./api/... and ./remote/api/.... Also the service worker's registration, the ?app address, changelog.md, and i18n/zh-cn.js, which Serve the board from a sub-path behind a reverse proxy, with relative URLs #99 didn't list: under a path, the Chinese board stayed in English.
  • sw.js: its fetches, icon and new window are relative, so they resolve against the worker's own address.
  • The manifest: start_url is ./ and the icon is icon.png. It no longer sets id. An id resolves against the origin, so "./" would give every board on one host the same identity. Without it, the id is the start_url, which at the root is / as before, so an installed app stays the same app.

A board at the root asks for the same paths as before, and getRegistration("./") there still finds the service worker registered at /.

Size

No dependency, setting or MCP change, so nothing an agent gets changes. The page's files change by a few bytes.

Tests

  • src/web.rs: the_page_asks_for_nothing_from_the_root checks index.html, app.js, sw.js and the manifest. It fails on main (at sw.js's "/api/push/pending") and passes here.

Tried in Chrome, behind Apache at /kanzo/ (ProxyPass "/kanzo/" "http://127.0.0.1:4343/", ProxyPreserveHost On, hosts = ["kanzo.localhost"]), and directly at the root:

  • loading the board, creating a project and a task, moving, editing, commenting and searching;
  • attaching an image and showing it;
  • What's new and the Chinese board;
  • the service worker registering, with scope /kanzo/ and /;
  • a shared board's request going to ./remote/api/... and reaching Kanzo.

Not tried: a push notification end to end, the installed app, and a real joined board.

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings and cargo test pass
  • A board change was tried in a browser, in light and dark mode (dark only; nothing visual changed)
  • The README says what changed for users, if anything did

The page, its service worker and the manifest asked for every file and
API path from the root, so behind a proxy that serves the board under a
path, like /kanzo/, they went to the proxy's root instead. They now ask
relative to where they were loaded. A board at the root asks for the
same paths as before.

Fixes #99
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

Resources

If merged, nothing moves by more than noise.

Agents

main this PR change
Tool list, read every session 3.9 KB 3.9 KB same
Instructions, read every session 496 B 496 B same
Reply to list_projects 73 B 73 B same
Reply to list_tasks (8) 316 B 316 B same
Reply to get_task 433 B 433 B same
Reply to next_task 450 B 450 B same
Reply to add_comment 37 B 37 B same
Reply to update_task 55 B 55 B same
Reply to create_task 42 B 42 B same

Program

main this PR change
Binary 5.66 MB 5.66 MB same
Crates in Cargo.lock 183 183 same

Memory

main this PR change
Idle board 6.86 MB 6.98 MB +118.8 KB (+1.7%)
Board with 3,000 tasks loaded 13.01 MB 13.06 MB +53.2 KB (+0.4%)
Peak of the board 13.01 MB 13.06 MB +53.2 KB (+0.4%)
kanzo mcp after a session 8.27 MB 8.30 MB +32.8 KB (+0.4%)
Threads when idle 1 1 same

Speed

main this PR change
Start 1.5 ms 1.4 ms same
/api/board with 3,000 tasks 9.5 ms 9.4 ms same

Storage

main this PR change
Empty database 99.5 KB 99.5 KB same
Database with 3,000 tasks 1.39 MB 1.39 MB same
/api/board reply with 3,000 tasks 1.08 MB 1.08 MB same
Board page (HTML, JS, logo) 174.2 KB 174.3 KB +102 B (+0.1%)

Measured on GitHub's ubuntu-26.04 runner, median of 3 rounds with the builds taking turns. Changes in bold are past noise: 1% for sizes, 5% for memory, 15% for times. Agents' text is in bytes: add an ANTHROPIC_API_KEY secret to count tokens.

@emanuele-em
emanuele-em merged commit 504993b into main Dec 3, 2026
11 checks passed
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.

Serve the board from a sub-path behind a reverse proxy, with relative URLs

1 participant