Web / Caddy Server Interview questions
Define matchers in Caddyfile?
A matcher is a condition that decides which requests a directive applies to. Without one, a directive applies to every request in its site block; with one, it only fires for requests that meet the condition.
example.com { @api path /api/* reverse_proxy @api localhost:4000 @images { path *.jpg *.png *.gif } header @images Cache-Control "public, max-age=86400" file_server }
Matchers prefixed with @ (like @api and @images) are named matchers and can be reused by multiple directives. Caddy also supports inline path matchers such as reverse_proxy /api/* localhost:4000 for simple, one-off cases.
More Related questions...