mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 22:23:48 +03:00
headers: Fix +
in Caddyfile to properly append rather than set (#4506)
This commit is contained in:
parent
3fe2c73dd0
commit
e9dde23024
2 changed files with 16 additions and 1 deletions
|
@ -13,6 +13,10 @@
|
||||||
header @images {
|
header @images {
|
||||||
Cache-Control "public, max-age=3600, stale-while-revalidate=86400"
|
Cache-Control "public, max-age=3600, stale-while-revalidate=86400"
|
||||||
}
|
}
|
||||||
|
header {
|
||||||
|
+Link "Foo"
|
||||||
|
+Link "Bar"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
----------
|
----------
|
||||||
{
|
{
|
||||||
|
@ -121,6 +125,17 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"handler": "headers",
|
||||||
|
"response": {
|
||||||
|
"add": {
|
||||||
|
"Link": [
|
||||||
|
"Foo",
|
||||||
|
"Bar"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ func applyHeaderOp(ops *HeaderOps, respHeaderOps *RespHeaderOps, field, value, r
|
||||||
if ops.Add == nil {
|
if ops.Add == nil {
|
||||||
ops.Add = make(http.Header)
|
ops.Add = make(http.Header)
|
||||||
}
|
}
|
||||||
ops.Add.Set(field[1:], value)
|
ops.Add.Add(field[1:], value)
|
||||||
|
|
||||||
case strings.HasPrefix(field, "-"): // delete
|
case strings.HasPrefix(field, "-"): // delete
|
||||||
ops.Delete = append(ops.Delete, field[1:])
|
ops.Delete = append(ops.Delete, field[1:])
|
||||||
|
|
Loading…
Reference in a new issue