Just looking for clarification that the documentation doesn’t mention…
I understand that different matchers in a matcher block are ANDed; also that a list of matches in a path or path_regexp line are ORed.
But what happens if you have multiple path or path_regexp lines? Are these recognised as logical continuations, and so ORed? After all, if they were ANDed they would always fail! Is this an allowed way of writing? Would they need to be adjacent?
You’ll notice that the first path_regexp actually gets dropped altogether, because the path_regexp matcher doesn’t support having two of them in one matcher set. This is a limitation of the Caddyfile at this time.
It is possible to get OR behaviour though, albeit super wacky:
@either {
not {
not path_regexp Foo ^/foo$
not path_regexp Bar ^/bar$
}
}
respond @either "Either"
This essentially does the boolean logic not (not Foo && not Bar) which is the same as Foo || Bar.
This is an area we’re looking to improve, for example this suggested feature (which is looking difficult to implement):
That said, path matchers do correctly get ORed, since a path matcher is defined as an array of paths.
The best way to verify for now is to look at the caddy adapt command’s output.