reverseproxy: fix misleading handle_response error for extra matcher args (#7869)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
pull/7867/head^2
TowyTowy 2026-07-10 07:40:23 +02:00 committed by GitHub
parent 75c988d118
commit 945d199724
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View File

@ -0,0 +1,10 @@
localhost:8884 {
reverse_proxy localhost:8000 {
handle_response header Foo {
respond "handled"
}
}
}
----------
parsing caddyfile tokens for 'reverse_proxy': too many arguments for 'handle_response': only a single response matcher name is allowed, but got: [header Foo]

View File

@ -923,13 +923,8 @@ func (h *Handler) FinalizeUnmarshalCaddyfile(helper httpcaddyfile.Helper) error
d.Next()
args := d.RemainingArgs()
// TODO: Remove this check at some point in the future
if len(args) == 2 {
return d.Errf("configuring 'handle_response' for status code replacement is no longer supported. Use 'replace_status' instead.")
}
if len(args) > 1 {
return d.Errf("too many arguments for 'handle_response': %s", args)
return d.Errf("too many arguments for 'handle_response': only a single response matcher name is allowed, but got: %s", args)
}
var matcher *caddyhttp.ResponseMatcher