Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 00:15 UTC
headers: Fix `+` in Caddyfile to properly append rather than set (#4506)
Francis Lavoie committed
Jan 4, 2022 at 12:10 UTC
e9dde230247ec5525d4c3803ff99c97e0dc8e348
2 files changed
+16
-1
caddytest/integration/caddyfile_adapt/header.txt
+15
@@ -13,6 +13,10 @@
13
header @images {
14
Cache-Control "public, max-age=3600, stale-while-revalidate=86400"
15
}
16
+ header {
17
+ +Link "Foo"
18
+ +Link "Bar"
19
+ }
20
}
21
----------
22
{
@@ -121,6 +125,17 @@
125
]
126
}
127
}
128
+ },
129
+ {
130
+ "handler": "headers",
131
+ "response": {
132
+ "add": {
133
+ "Link": [
134
+ "Foo",
135
+ "Bar"
136
+ ]
137
+ }
138
+ }
139
}
140
]
141
}
modules/caddyhttp/headers/caddyfile.go
+1
-1
@@ -222,7 +222,7 @@ func applyHeaderOp(ops *HeaderOps, respHeaderOps *RespHeaderOps, field, value, r
222
if ops.Add == nil {
223
ops.Add = make(http.Header)
224
}
225
- ops.Add.Set(field[1:], value)
225
+ ops.Add.Add(field[1:], value)
226
227
case strings.HasPrefix(field, "-"): // delete
228
ops.Delete = append(ops.Delete, field[1:])