Skip to content

Header matcher docs are confusing #503

Description

@zotanmew

The documentation for the header matcher (https://caddyserver.com/docs/caddyfile/matchers#header) is quite confusing in terms of how to match multiple (OR'd) values for the same field.

Currently, it reads header <field> [<value> ...], which strongly implies that header Field a b c should be valid syntax, however this yields the error Error: adapting config using caddyfile: parsing caddyfile tokens for 'route': malformed header matcher: expected both field and value.

I was eventually able to figure out that Different header fields within the same set are AND-ed. Multiple values per field are OR'ed. means that the following syntax is the intended way to specify multiple OR'd values:

@match {
    header Field a
    header Field b
    header Field c
}

This is very confusing, as in most if not all other places multiple values that get OR'd in matchers are put on the same line, while values that get AND'd get put on multiple lines.

While ideally this syntax would simply be supported in caddy, as it seems like the intuitive syntax given how matchers are specified otherwise, this behavior being clarified in the docs would already go a long way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions