Repository navigation
docs(config): document frontend rule order and reload limits - #1681
Merged
Merged
Conversation
Document how rules are ordered within a frontend position: PRE rules, then the routing trie, then POST rules; inside PRE or POST the first matching rule wins in the order the worker received the rules, while the trie follows hostname and path specificity. Also document two limits of the current behaviour: a configuration reload refuses every frontend whose address, hostname, path and method already exist, so reordering the file or changing only the position or cluster of an existing frontend has no effect, and a frontend deleted from the file is not removed; a new or upgraded worker receives the frontends sorted by that key rather than in insertion order. No behaviour change. Refs #952 Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
requested review from
Wonshtrum and
llenotre
as code owners
September 29, 2026 08:32
This was referenced Sep 29, 2026
Closed
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.
Summary
Documents how rules are ordered within a frontend
position, answering #952, and states two limits of the current reload/worker behaviour. Docs only, no behaviour change.doc/configure.md: new "Rule order withinPREandPOST" section after "Catch-all hostname", plus a cross-reference from "When declaration order decides".bin/config.toml: short summary under thepositionoption.CHANGELOG.md:docsentry under Unreleased / Changed.Evidence (origin/main ebf4b70)
Routerholdspre: Vec,tree,post: Vec(lib/src/router/mod.rs:85-89);Router::lookupscanspreand returns the first match (lib/src/router/mod.rs:141-154), then the trie (:156-196), thenpost(:198-211).add_pre_rule/add_post_rulepusha new rule and refuse a duplicate (domain, path, method) (lib/src/router/mod.rs:622-705), dispatched fromRulePositionatlib/src/router/mod.rs:317-322.*(lib/src/router/mod.rs:157-159); path selection inselect_tree_rule(lib/src/router/mod.rs:845), whose declaration-order cases are already in "When declaration order decides".ReloadConfigurationcallsload_static_config(bin/src/command/requests.rs:389-391,:935), which re-dispatches every generated request with no removal step;ConfigState::diff(command/src/state.rs:2076) is not on this path.add_frontend_to(command/src/state.rs:1141) returnsStateError::Existsfor an existing key, and the entry is skipped beforescatter_on(bin/src/command/requests.rs:1048). The key isaddress;hostname;{P|R|=}path[;method](command/src/request.rs:263) and carries neitherpositionnorcluster_id.http_fronts/https_frontsareBTreeMap<String, HttpFrontend>(command/src/state.rs:169,:171);generate_requestsiterates them in key order (command/src/state.rs:1919,:1936) and feedsproduce_initial_state(command/src/state.rs:2971), written to the forked worker byfork_main_into_worker(bin/src/worker.rs:272,:291), called frombin/src/command/server.rs:1309.The reload and worker-replay behaviour described here is documented as it is today, not endorsed; #952 stays open for the reload fix.
Validation
python3 .github/scripts/check_doc_citations.py --self-test-> exit 0python3 .github/scripts/check_doc_citations.py --root .-> exit 0 (OK: all 48 ... citations ... resolve to a non-blank line.)python3 .github/scripts/check_doc_citations.py --base origin/main-> exit 0python3 .github/scripts/check_doc_citations.py --audit --root .-> exit 0, no finding on the changed filesRefs #952