Skip to content

Serve the board under a path behind a reverse proxy - #101

Closed
baron-hines wants to merge 1 commit into
emanuele-em:mainfrom
baron-hines:relative-urls
Closed

baron-hines wants to merge 1 commit into
emanuele-em:mainfrom
baron-hines:relative-urls

Conversation

@baron-hines

@baron-hines baron-hines commented Dec 3, 2026 •

Copy link
Copy Markdown

For #99.

The board asked for everything at the root (/app.js, /api/..., /logo.png, /sw.js), so behind a proxy that serves it under a path, like /kanzo/, those requests went to the proxy's root. This makes the board's URLs relative to the page, with no new setting:

  • base() returns "." or "./remote". api(), the two direct task fetch calls and the image links already go through it.
  • The page (index.html) and the manifest (web.rs) name their files without a leading slash. A manifest's relative URLs resolve against the manifest's own URL.
  • app.js: changelog.md, i18n/<lang>.js, register("sw.js"), getRegistration("./") and history.replaceState("./?app").
  • sw.js builds its URLs from its own scope (new URL(path, self.registration.scope)): api/push/pending, api/push, icon.png and openWindow.
  • The README says the board works under a path, with an nginx example.

A board at the root asks for the same URLs as before. The server's routes, the API and MCP don't change.

Tested:

  • cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings and cargo test --locked pass: 153 tests, on stable Rust.
  • app.js, sw.js and zh-cn.js parse as ES2020 (acorn).
  • Browsers: current Chromium and Firefox (Playwright), in light and dark, against this branch's build twice: at the root (localhost:4499), and behind nginx at /kanzo/ (location /kanzo/ { proxy_pass http://127.0.0.1:4499/; proxy_set_header Host $http_host; }, hosts = ["localhost"]). In all 8 runs:
    • a project and a card are made, edited, moved and found by search through the board's own api();
    • an image is attached with uploadImage() and shown from base()/images/;
    • changelog.md and i18n/zh-cn.js load;
    • the service worker registers with the board's own scope (http://localhost:8199/kanzo/ behind the proxy);
    • the manifest's start_url and icon resolve under it;
    • no request leaves the board's address.
  • The one refusal is the board's GET /api/network on load, answered 403 at both addresses. That's the existing rule for listed hosts (this_computer, and the test at web.rs:1776), since the test lists localhost. The page already catches it.

Not tested:

  • Safari 13.1, Chrome 80, Firefox 78: none here. The change adds no syntax, only paths and new URL(path, scope), which those versions have, so the ES2020 parse stands in, as in Load the board again on Safari 13.1, Chrome 80 and Firefox 78 #90.

  • Live push notifications and a shared or joined board: not run. Their paths go through the same base() and the service worker's scope.

  • 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

  • The README says what changed for users, if anything did

· Generated with Claude Code · Opus 5.5 ·

The board asked for everything at the root (/app.js, /api/..., /logo.png,
/sw.js), so behind a proxy that serves it under a path, like /kanzo/, its
requests went to the proxy's root instead. Its URLs are now relative to the
page: base() returns "." or "./remote", the page and the manifest name their
files without a leading slash, and the service worker builds its URLs from
its own scope. A board at the root asks for the same URLs as before.

For emanuele-em#99.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@baron-hines
baron-hines marked this pull request as ready for review December 3, 2026 03:41
@baron-hines baron-hines closed this Dec 3, 2026
@baron-hines
baron-hines deleted the relative-urls branch December 3, 2026 20:37
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.

1 participant