Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 08:30 UTC
reverseproxy: fix misleading handle_response error for extra matcher args (#7869)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
TowyTowy committed
Jul 10, 2026 at 07:40 UTC
945d199724f17f313c7fbc90eceba70fe37f47e6
2 files changed
+11
-6
caddytest/integration/caddyfile_adapt/reverse_proxy_handle_response_too_many_args.caddyfiletest
new
+10
@@ -0,0 +1,10 @@
1
+localhost:8884 {
2
+ reverse_proxy localhost:8000 {
3
+ handle_response header Foo {
4
+ respond "handled"
5
+ }
6
+ }
7
+}
8
+
9
+----------
10
+parsing caddyfile tokens for 'reverse_proxy': too many arguments for 'handle_response': only a single response matcher name is allowed, but got: [header Foo]
modules/caddyhttp/reverseproxy/caddyfile.go
+1
-6
@@ -923,13 +923,8 @@ func (h *Handler) FinalizeUnmarshalCaddyfile(helper httpcaddyfile.Helper) error
923
d.Next()
924
args := d.RemainingArgs()
925
926
- // TODO: Remove this check at some point in the future
927
- if len(args) == 2 {
928
- return d.Errf("configuring 'handle_response' for status code replacement is no longer supported. Use 'replace_status' instead.")
929
- }
930
-
926
if len(args) > 1 {
932
- return d.Errf("too many arguments for 'handle_response': %s", args)
927
+ return d.Errf("too many arguments for 'handle_response': only a single response matcher name is allowed, but got: %s", args)
928
}
929
930
var matcher *caddyhttp.ResponseMatcher