Repository navigation
caddytls: keep repeated matchers in nested matcher sets - #8137
Merged
francislavoie merged 1 commit intoOct 4, 2026
Merged
Conversation
ParseCaddyfileNestedMatcherSet collected the tokens of a repeated matcher but passed them to caddyfile.UnmarshalModule, which reads only the first segment, so a second sni or remote_ip line in a match block was silently dropped. Pass all tokens to UnmarshalCaddyfile, like the caddyhttp version does.
francislavoie
approved these changes
Oct 4, 2026
francislavoie
enabled auto-merge (squash)
October 4, 2026 16:07
This was referenced Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
caddytls.ParseCaddyfileNestedMatcherSetgroups the tokens of a repeated matcher, then hands them tocaddyfile.UnmarshalModule, which reads only the first segment. So this blockgives
{"sni":["example.com"]}, and the second line is ignored without an error. Aremote_ip !10.1.2.3exclusion on its own line is lost the same way.This passes all the tokens to
UnmarshalCaddyfile, likecaddyhttp.ParseCaddyfileNestedMatcherSetdoes. The TLS matchers are written to handle several segments. A repeatedsni_regexpnow returns its existing "regular expression can only be used once" error instead of dropping the second pattern.It came up while working on #8097. I kept it out of the
notmatcher PR, as asked there.Assistance Disclosure
Claude Code (claude-opus-5-5) found this while testing the
notmatcher, wrote the fix, I tested it. I reviewed every line