#8079·caddy

headers: "set" joins multiple Set-Cookie values into one comma-separated field

Author: Indra55Created Sep 28, 2026Updated Sep 28, 2026

Issue Details

When the headers handler sets multiple Set-Cookie values, it joins them into one comma-separated field, so clients may only get one cookie. Set-Cookie can't be folded like that (RFC 6265, RFC 9110 section 5.3).

Reproduced with a built binary.Save as caddy.json:

json
{
  "admin": {"disabled": true},
  "apps": {
    "http": {
      "servers": {
        "test": {
          "listen": ["127.0.0.1:19080"],
          "routes": [{
            "handle": [
              {"handler": "headers", "response": {"set": {
                "Set-Cookie": ["a=1; Path=/", "b=2; Path=/"]
              }}},
              {"handler": "static_response", "body": "ok"}
            ]
          }]
        }
      }
    }
  }
}

Run caddy run --config caddy.json, then curl -i http://127.0.0.1:19080/.

Expected: two separate Set-Cookie fields, one per cookie.

Actual: one field:

HTTP/1.1 200 OK
Set-Cookie: a=1; Path=/,b=2; Path=/

Assistance Disclosure

AI not used

If AI was used, describe the extent to which it was used.

No response