Skip to content

caddyhttp: lower-case path patterns with placeholders at request time - #8343

Merged
steadytao merged 2 commits into
caddyserver:masterfrom
BenMacha:path-matcher-dynamic-patterns
Nov 4, 2026
Merged

steadytao merged 2 commits into
caddyserver:masterfrom
BenMacha:path-matcher-dynamic-patterns

Conversation

@BenMacha

@BenMacha BenMacha commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #6387. Follow-up to #8319, reworked as suggested by @steadytao: no placeholder parser anymore.

Path patterns that contain placeholders are left untouched at provisioning, and the expanded pattern is lower-cased at request time. Static patterns are still lower-cased once at provisioning, so they cost nothing more per request.

Before, {env.FOO} was looked up as env.foo, and values such as {vars.cycle} = 2024-MAR-21 could never match the lower-cased request path.

Assistance Disclosure

The bug was found during a code review done with Claude Code (Anthropic), which also drafted the fix and the tests. I reviewed the change, can explain every line, and ran go test -race -short on the affected package before opening this PR.

Patterns with placeholders were lower-cased at provisioning, which
changed case-sensitive placeholder names such as {env.FOO}, while the
replaced values were never lower-cased and so could not match the
lower-cased request path. Leave such patterns untouched at provisioning
and lower-case the expanded pattern at request time.

Fixes caddyserver#6387
Comment thread modules/caddyhttp/matchers_test.go Resolved
@steadytao steadytao added the bug 🐞 Something isn't working label Nov 4, 2026
@steadytao steadytao added this to the v2.12.0 milestone Nov 4, 2026
@steadytao
steadytao merged commit 2147da7 into caddyserver:master Nov 4, 2026
32 checks passed
@francislavoie francislavoie modified the milestones: v2.12.0, v2.11.9 Nov 4, 2026
francislavoie pushed a commit that referenced this pull request Nov 5, 2026
…#8343)

* caddyhttp: lower-case path patterns with placeholders at request time

Patterns with placeholders were lower-cased at provisioning, which
changed case-sensitive placeholder names such as {env.FOO}, while the
replaced values were never lower-cased and so could not match the
lower-cased request path. Leave such patterns untouched at provisioning
and lower-case the expanded pattern at request time.

Fixes #6387

* caddyhttp: restore the encoded separator path matcher tests

(cherry picked from commit 2147da7)
@github-actions github-actions Bot mentioned this pull request Nov 5, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vars not expanded in path directives

3 participants