This quote is about matchers that are part of the same named matcher. You instead have two separate named matchers, so it’s not exactly the same.
The Caddyfile adapter will sort matcher/handler pairs first by the directive order, then if they are the same directive, by the length of their path
matchers. If they have no path matcher, then one with a named matcher defined will sort higher than one without a named matcher (i.e. match-all).
Note that this is specifically path matchers and not path_regexp matchers. So by these rules, your two directives will be equal in the sorting.
I think that Golang will retain the original order of elements considered equal, but I’m not 100% certain. I’ll need to verify to be sure.
But if you want to be certain about the order these run in, you can wrap both in a route
block which will ensure their order is preserved.
In the thread you linked, handle
is used to split the named matcher into two distinct phases, essentially like wrapping if blocks inside eachother instead of using a logical AND (which the Caddyfile doesn’t make directly possible, because order matters with AND).
If you use the debug
global option, you’ll see a message in the logs about the rewrite when it happens.
Hopefully that all makes sense!