Skip to content

router: $HOST[n] captures are numbered right-to-left for tree rules but left-to-right for pre/post rules #1595

Closed

Description

@FlorentinDUBOIS

Found while working on #1594. Nothing in the code has changed yet; this issue only records the inconsistency.

A tree-shaped host rule numbers the $HOST[n] captures of its regex segments right to left (in reverse domain order, the order the pattern trie walks). A pre/post (prefix/suffix) host rule numbers them left to right.

The same hostname shape therefore produces different $HOST[n] values depending on how the rule was compiled. Any rewrite template that uses $HOST[n] may pick a different label than its author expected.

a_host_capture_past_sixteen_trie_segments_keeps_every_segment, added in #1594, pins the current tree order so that the allocation change does not alter it.

To decide

  • Which order is the documented contract? Check doc/ for $HOST[.
  • Should the tree path reverse its captures to match? That changes behaviour for existing tree rules, so it needs a CHANGELOG entry and a migration note.

Activity

  1. added a commit that references this issue on Sep 27, 2026
    4620481
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions