Skip to content

caddyhttp: Evaluate tls.client placeholders more accurately (fix #7530)#7534

Merged
mholt merged 1 commit intomasterfrom
client-cert-placeholders
Mar 1, 2026
Merged

caddyhttp: Evaluate tls.client placeholders more accurately (fix #7530)#7534
mholt merged 1 commit intomasterfrom
client-cert-placeholders

Conversation

@mholt
Copy link
Member

@mholt mholt commented Feb 27, 2026

This should cause placeholders to be replaced with empty string when ReplaceKnown() is used, even if no client cert is presented.

Assistance Disclosure

No AI was used.

@felixhummel
Copy link

LGTM. I verified against #7530.

$ cd ~/github/caddy
$ git checkout client-cert-placeholders
$ cd cmd/caddy/
$ go build
$ cd ~/repro/caddy-tls-subject-header-up
$ go run ./echo/main.go :44001
$ ~/github/caddy/cmd/caddy/caddy run --config Caddyfile --watch
$ curl -fsSL --cacert 0-tmp-ca.crt https://example.localhost:44443 | rg ^X-Sub
X-Subject:
X-Subject-Long-Placeholder:

@francislavoie
Copy link
Member

This could be a breaking change for configs that rely on a missing cert returning false (e.g. vars matcher maybe).

Makes sense to me though in principle.

@mholt
Copy link
Member Author

mholt commented Mar 1, 2026

Thank you both! (And yes, that's true.)

@mholt mholt merged commit 174fa2d into master Mar 1, 2026
28 checks passed
@mholt mholt deleted the client-cert-placeholders branch March 1, 2026 05:03
@github-actions github-actions bot mentioned this pull request Mar 6, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tls_client_subject set to literal {http.request.tls.client.subject} without client cert

3 participants