Repository navigation
Description
Component
decdn gateway: a site origin's /_decdn/ paths (Gateway::entry and the /_decdn/ branch of the site handler in crates/cli/src/commands/gateway.rs).
Version
v0.3.0 and main (e7e67e6, v0.3.1).
Steps to reproduce
- Publish a bundle
<h>with an entrydocs/index.htmland no entrydocs. - From a page on any site origin, issue a same-origin request (not a navigation) for
/_decdn/<h>/docs, e.g.fetch("/_decdn/<h>/docs"). - Follow the redirect.
Expected behavior
The request ends at docs/index.html, as /docs does on <h>'s own site (a_site_directory_serves_its_index).
Actual behavior
entry()finds no entrydocs, but findsdocs/index.html. UnderPresent::Siteit answers302with the relativeLocation: docs/. The comment there says this "holds under/_decdn/too".- The browser resolves that to
/_decdn/<h>/docs/. - The
/_decdn/branch parses the rest asdecdn:<h>/docs/directly. That branch has no "a directory serves itsindex.html" step: the site's own paths get one (path.ends_with('/')→{path}index.html), but/_decdn/does not. decode_pathrefuses the trailing empty segment ("empty segment (a leading, trailing or doubled/inside the path)"), so the gateway answers400.
A second problem: the relative Location drops the query. So /_decdn/<h>/docs?ns=7 lands on /_decdn/<h>/docs/ without its ?ns=7 routing hint.
Logs
n/a. a_site_directory_serves_its_index (gateway/tests.rs) covers /docs on the site's own origin, and no test covers a directory under /_decdn/.
Possible fixes
Either:
- Map a trailing
/under/_decdn/<h>/…/to…/index.html, as the site's own paths do, before parsing. Also keep the query on the redirect (Location: docs/?ns=7). - Or, under
/_decdn/, redirect a directory straight to<dir>/index.htmlwith the query, so the target is a URI the parser accepts.
Notes
@decdn/client is unaffected when it verifies: it reads the manifest and fetches docs/index.html (decdn/sdk-typescript#21). It is affected with verify: false on a site page: get("decdn:<h>/docs", { verify: false }) goes through /_decdn/ and gets the 400. The SDK's fake gateway mirrors the redirect as it is today, so the fix needs a matching sdk-typescript change to the fake (and a contract test once the fixture has a directory entry).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
test(fake): redirect a site directory and serve one under /_decdn/ as…
feat!: pending-key capabilities, scoped registration, capabilities-on…