Repository navigation
Answer the bare /osa mount path with a 308 - #501
Merged
Merged
Conversation
A mounted host's /osa/* route does not match /osa, which reached the placeholder origin and answered 522 (#500). Each host now also routes the bare path, and the worker redirects it to /osa/ with its query. The Apache config redirects /osa and /osa-dev the same way. Tested: bun workers/osa-worker/test-routing.js (139 pass), test-mounted-hosts.js (16 pass); removing the redirect fails 7 routing tests, removing a bare route fails the mounted-hosts pin.
A route pattern without a trailing wildcard never matches a URL with a query string, so the exact /osa route still left /osa?x=1 at 522. Each mounted host now routes /osa*; the worker 404s the /osafoo paths that route also delivers, rather than reading them as a community. Tested: test-routing.js 147 pass, test-mounted-hosts.js 18 pass, wrangler deploy --dry-run for both environments; dropping the 404, an exact /osa route, or the dev bare route each fail a test.
Contributor
|
Worker changes detected. After merging to Manual deployment (if needed): cd workers/osa-worker
wrangler deploy --env dev # for develop branch
wrangler deploy # for main branch |
14 of 24 tasks
fetch() redirects the bare /osa before stripping, so the branch mapping it to / could no longer run. Tested: test-routing.js 147 pass, test-mounted-hosts.js 18 pass.
This was referenced Sep 24, 2026
Merged
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.
Closes #500.
widget.osc.earth/osa/works andwidget.osc.earth/osaanswered 522: the Worker's zone routewidget.osc.earth/osa/*does not match the bare path, so the request fell through to the placeholderAAAA 100::origin.api.osc.earth/osaanswered 404 for the same reason in Apache (ProxyPass /osa/).Changes
workers/osa-worker/wrangler.toml: each mounted host (widget.osc.earth,develop-widget.osc.earth) also routes/osa*. The trailing wildcard is required: Cloudflare matches a route against the whole URL including its query string, and a pattern without a trailing*never matches a URL that has one, so an exact/osaroute would still leave/osa?x=1at 522. When patterns overlap the most specific wins, so a laterwidget.osc.earth/osafoo/*route would still take its own paths.workers/osa-worker/index.js: on a mounted host, a request for exactly/osaanswers308withLocation: /osa/and the query string kept (308 rather than 301, so a POST keeps its method and body). A path the/osa*route also delivers but that is outside the mount, such as/osafoo/chat, answers 404 rather than being read as communityosafoo.deploy/apache-api.osc.earth.conf:RedirectMatch 308 ^/osa$ /osa/and^/osa-dev$ /osa-dev/.RedirectMatchmatches the path only and carries the query string over. The server's copy is applied by hand.test-mounted-hosts.js: every mounted host must route both/osa/*and/osa*, and must not have an exact/osaroute; route hosts are de-duplicated now that each host has two routes.test-routing.js: the bare path redirects on both hosts and keeps the query; its preflight is answered, not redirected;/osafooand/osafoo/chatare 404 on a mounted host and an ordinary community path on an unmounted one;/osa/still serves the root.Tested
bun workers/osa-worker/test-routing.js: 147 passbun workers/osa-worker/test-mounted-hosts.js: 18 passwrangler deploy --dry-run, top level and--env dev/osaroute fails 3 mounted-hosts pins; removing the dev bare route fails 1worker.fetch()directly and cannot exercise Cloudflare's route dispatch, so the query-string case is proven only after deploy (below)After merge
sync-worker-cors.ymldeploys the dev worker; ondevelop-widget.osc.earth,curl -sIof/osaanswers 308 to/osa/,/osa?x=1answers 308 to/osa/?x=1, and/osafooanswers 404 from the worker, not 522widget.osc.earthcurl -sI https://api.osc.earth/osaanswers 308