caddyserver / caddyserver/website

Header matcher docs are confusing

Open
#503 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
HTML
Stars
227
Forks
213
Avg merge
3h 52m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the header matcher section linked in the issue and review the current syntax example and explanation of AND/OR behavior. Clarify how to express multiple OR'd values for one field, then verify that the documentation matches the reported configuration error and intended syntax.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.