Fun (actually not fun at all) fact about Caddy:
This expression will be merged with AND
:
@matcher {
path /foo
header Header-Name value
}
But this one will be merged with OR
, despite being functionally identical:
@matcher {
expression `path('/foo')`
expression `header({'Header-Name': 'value'})`
}
Caddy has some cursed, barely-documented logic where matcher blocks always merge with AND
unless two matchers of the same time are adjacent. In the latter case, they may be merged with
AND
or OR
depending on matcher-specific logic, which is not publicly documented.
This results in completely different behavior depending on whether a matcher is defined using expression or directive syntax. Despite the docs implying that the two options are identical, they are not! You can have an existing, functional matcher with a mix of directives and expressions, and suddenly it breaks because one of the directives was replaced with an
identical expression. It's extremely counter-intuitive.
#Caddy #PSA #ServerAdmin #SelfHost