Repository navigation
Serve the board under a path behind a reverse proxy - #101
Closed
baron-hines wants to merge 1 commit into
Closed
baron-hines wants to merge 1 commit into
baron-hines wants to merge 1 commit into
Conversation
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>
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.
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 taskfetchcalls and the image links already go through it.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("./")andhistory.replaceState("./?app").sw.jsbuilds its URLs from its own scope (new URL(path, self.registration.scope)):api/push/pending,api/push,icon.pngandopenWindow.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 warningsandcargo test --lockedpass: 153 tests, on stable Rust.app.js,sw.jsandzh-cn.jsparse as ES2020 (acorn).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:api();uploadImage()and shown frombase()/images/;changelog.mdandi18n/zh-cn.jsload;http://localhost:8199/kanzo/behind the proxy);start_urland icon resolve under it;GET /api/networkon load, answered 403 at both addresses. That's the existing rule for listedhosts(this_computer, and the test atweb.rs:1776), since the test listslocalhost. 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 warningsandcargo testpassA 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 ·