Skip to content

[Request]: Wildcard-suffix redirect path shape (/legacy/** → {**}) #387

Closed

Description

@jimhoyd

Follow-up to #383. redirect refuses a terminal /* (only accepted on static/extension) and {rest...} is not a valid parameter name; confirmed by running urlcode validate against both. This is the first path-shape exception to "exact or {param}, no general-purpose wildcard" in ROUTING.md, so it needs a maintainer decision before implementation.

Proposed shape: a route key ending /**, accepted only under redirect (e.g. /legacy/**), matching one or more remaining segments as a single named capture, usable once in the destination path as {**}. The capture is encoded as its segments joined by /, not re-decoded — a %2F in the input stays literal in the placeholder and cannot introduce an extra segment on redirect.

Effects: validate/explain/routes/audit show it like any parameterized redirect. Ordering must place a /** route after every literal and single-placeholder route at the same prefix, so nothing overshadows a more specific match.

Security: the destination is still checked as a literal absolute HTTP(S) host, so this only relaxes the source path shape — a capture only ever lands in the destination path, never the host or scheme, keeping it closed to open-redirect abuse from the captured value. Also reject a capture equal to ./.. segments and cap total captured length.

Until decided: report the gap; the tested workaround is one fixed-depth route per depth, or urlcode bulk-import for a known finite set of paths.

Full analysis: docs/OPEN-DECISIONS.md ("Wildcard-suffix redirect" row).

Activity

  1. added
    enhancement
    needs-decision
    on Sep 21, 2026
  2. jimhoyd commented on Sep 21, 2026

    @jimhoyd
    CollaboratorAuthor

    Benchmark evidence update (Redirector v8, pinned @jimhoyd/[email protected]): the completed URLCode arm passed the frozen two-segment /legacy/a/b redirect check using four explicit fixed-depth routes and one custom function. Its evidence map records that the workaround supports one through four segments only; deeper paths remain unverified. This validates the stated temporary workaround, not native wildcard support. Public redacted evidence: https://github.com/jimhoyd-com/urlcode-benchmarks/tree/codex/benchmark-program/results/bundles/2026-09-21-redirector-sonnet-v8

  3. jimhoyd commented on Sep 22, 2026

    @jimhoyd
    CollaboratorAuthor

    Implemented in f9bd0ae (feat: root-relative redirect destinations and /** suffix wildcard, part of #383). A route key ending /** is now accepted under redirect, capturing the remaining segments as {**} in the destination path, with the safety guards this issue proposed (host/scheme always literal, no dot-segment or encoded-slash smuggling, ordering behind exact/{param} routes). See ROUTING.md and the "Wildcard-suffix redirect" row in docs/OPEN-DECISIONS.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions