summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2023-06-15 19:18:55 -0400
committerGitHub <noreply@github.com>2023-06-15 17:18:55 -0600
commit3b19aa2b5a77440f8cb4d11e80937935d187f1cd (patch)
tree21785c937980122f3ac66cfb393ab885228fd700 /modules/caddyhttp
parent6a41b62e70f867eff30b38a8ff33e90108077b0f (diff)
headers: Allow `>` to defer shortcut for replacements (#5574)
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/headers/caddyfile.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/caddyhttp/headers/caddyfile.go b/modules/caddyhttp/headers/caddyfile.go
index d7e644c..2b06910 100644
--- a/modules/caddyhttp/headers/caddyfile.go
+++ b/modules/caddyhttp/headers/caddyfile.go
@@ -247,10 +247,14 @@ func applyHeaderOp(ops *HeaderOps, respHeaderOps *RespHeaderOps, field, value, r
respHeaderOps.Set.Set(field, value)
case replacement != "": // replace
+ // allow defer shortcut for replace syntax
+ if strings.HasPrefix(field, ">") && respHeaderOps != nil {
+ respHeaderOps.Deferred = true
+ }
if ops.Replace == nil {
ops.Replace = make(map[string][]Replacement)
}
- field = strings.TrimLeft(field, "+-?")
+ field = strings.TrimLeft(field, "+-?>")
ops.Replace[field] = append(
ops.Replace[field],
Replacement{