summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/reverseproxy')
-rw-r--r--modules/caddyhttp/reverseproxy/caddyfile.go25
1 files changed, 19 insertions, 6 deletions
diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go
index c5f8e17..003f676 100644
--- a/modules/caddyhttp/reverseproxy/caddyfile.go
+++ b/modules/caddyhttp/reverseproxy/caddyfile.go
@@ -480,6 +480,8 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
h.BufferRequests = true
case "header_up":
+ var err error
+
if h.Headers == nil {
h.Headers = new(headers.Handler)
}
@@ -487,18 +489,25 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
h.Headers.Request = new(headers.HeaderOps)
}
args := d.RemainingArgs()
+
switch len(args) {
case 1:
- headers.CaddyfileHeaderOp(h.Headers.Request, args[0], "", "")
+ err = headers.CaddyfileHeaderOp(h.Headers.Request, args[0], "", "")
case 2:
- headers.CaddyfileHeaderOp(h.Headers.Request, args[0], args[1], "")
+ err = headers.CaddyfileHeaderOp(h.Headers.Request, args[0], args[1], "")
case 3:
- headers.CaddyfileHeaderOp(h.Headers.Request, args[0], args[1], args[2])
+ err = headers.CaddyfileHeaderOp(h.Headers.Request, args[0], args[1], args[2])
default:
return d.ArgErr()
}
+ if err != nil {
+ return d.Err(err.Error())
+ }
+
case "header_down":
+ var err error
+
if h.Headers == nil {
h.Headers = new(headers.Handler)
}
@@ -510,15 +519,19 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
args := d.RemainingArgs()
switch len(args) {
case 1:
- headers.CaddyfileHeaderOp(h.Headers.Response.HeaderOps, args[0], "", "")
+ err = headers.CaddyfileHeaderOp(h.Headers.Response.HeaderOps, args[0], "", "")
case 2:
- headers.CaddyfileHeaderOp(h.Headers.Response.HeaderOps, args[0], args[1], "")
+ err = headers.CaddyfileHeaderOp(h.Headers.Response.HeaderOps, args[0], args[1], "")
case 3:
- headers.CaddyfileHeaderOp(h.Headers.Response.HeaderOps, args[0], args[1], args[2])
+ err = headers.CaddyfileHeaderOp(h.Headers.Response.HeaderOps, args[0], args[1], args[2])
default:
return d.ArgErr()
}
+ if err != nil {
+ return d.Err(err.Error())
+ }
+
case "transport":
if !d.NextArg() {
return d.ArgErr()