Skip to content

Commit

Permalink
headers: Fix + in Caddyfile to properly append rather than set (#4506)
Browse files Browse the repository at this point in the history
  • Loading branch information
francislavoie authored Jan 4, 2022
1 parent 3fe2c73 commit e9dde23
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions caddytest/integration/caddyfile_adapt/header.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
header @images {
Cache-Control "public, max-age=3600, stale-while-revalidate=86400"
}
header {
+Link "Foo"
+Link "Bar"
}
}
----------
{
Expand Down Expand Up @@ -121,6 +125,17 @@
]
}
}
},
{
"handler": "headers",
"response": {
"add": {
"Link": [
"Foo",
"Bar"
]
}
}
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion modules/caddyhttp/headers/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func applyHeaderOp(ops *HeaderOps, respHeaderOps *RespHeaderOps, field, value, r
if ops.Add == nil {
ops.Add = make(http.Header)
}
ops.Add.Set(field[1:], value)
ops.Add.Add(field[1:], value)

case strings.HasPrefix(field, "-"): // delete
ops.Delete = append(ops.Delete, field[1:])
Expand Down

0 comments on commit e9dde23

Please sign in to comment.