Are routes with a '/' match guaranteed to be considered "catch-all" routes? #61547
Replies: 1 comment
|
Deliberate rather than incidental, but the promise that is actually written down is narrower than the one you described, and the difference is worth knowing before you rely on it. It is intentional, and the intent is on the recordThe relocation arrived with #8114 (merged 2018-08-23), whose body states the purpose outright: "This is the rudimentary merge of http routes, pushing the wildcard/catch all routes to the end", fixing #7793 "for Gateways only". So moving catch-alls last is the feature, not a side effect of it. It is also documented, under Split large virtual services and destination rules into multiple resources:
And it is pinned by tests rather than left to chance. Where your reading is broader than the documented contractTwo gaps, and the first is the one that bears on your exact case. The docs define a catch-all as "a rule without a Second, it is gateway-only, and narrowly so. What is still undefined, and why it stayed narrowThe guarantee is only that catch-alls end up after non-catch-alls. It says nothing about ordering among catch-alls, which is why the docs tell you to have only one: with two, whichever lands first swallows everything and disables the other. It also applies no specificity ordering to the remaining routes, so a That narrowness is historical rather than accidental. The first attempt at this sorted routes by specificity, and in #10485 a maintainer explains that the implementation "had side effects that were not backward compatible, so the implementation was changed in #8114, before it was released", then closed the issue as working as designed. What survived is the one property that could ship without breaking existing configurations: catch-alls to the end. So I would treat it as supported behaviour for the case the docs describe, and as an implementation detail for the broader "an explicit |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The documentation says that cross-resource rule ordering is undefined and describes catch-all rules as being moved to the end of the merged configuration.
Looking at the current implementation, SortVHostRoutes() is applied after routes from matching VirtualServices have been accumulated into the Envoy vhost, and IsCatchAllRoute() treats an unconstrained prefix: "/" route as a catch-all.
This appears to mean that, although general cross-resource ordering is undefined, an unconstrained uri.prefix: "/" rule from one VirtualService is deliberately guaranteed by the current implementation to follow more-specific URI routes from other VirtualServices on the same vhost.
Relevant: #10485
Is this behavior intended to be a supported routing guarantee, or should it be treated as an implementation detail?
All reactions