1. The problem I’m having:
I have an upstream server setting PHPSESSID cookie with Set-Cookie
header in a format like PHPSESSID=1sqkri8n8l0jioth9l5mie4vk1; path=/
I want to suffix this value with ; SameSite=None; Secure
I tried humongous GPT-generated) configs to try to achieve that - it won’t. It either does nothing either returns 2 Set-Cookie headers - original one and the ; SameSite=None
one separately.
2. Error messages and/or full log output:
2023/06/14 06:21:04.161 INFO using adjacent Caddyfile
2023/06/14 06:21:04.162 WARN Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies {"adapter": "caddyfile", "file": "Caddyfile", "line": 2}
2023/06/14 06:21:04.163 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
2023/06/14 06:21:04.164 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc000445650"}
2023/06/14 06:21:04.165 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2023/06/14 06:21:04.165 INFO tls cleaning storage unit {"description": "FileStorage:/home/theuargb/.local/share/caddy"}
2023/06/14 06:21:04.165 INFO tls finished cleaning storage units
2023/06/14 06:21:04.165 INFO autosaved config (load with --resume flag) {"file": "/home/theuargb/.config/caddy/autosave.json"}
2023/06/14 06:21:04.165 INFO serving initial configuration
3. Caddy version:
2.6.4
4. How I installed and ran Caddy:
a. System environment:
Fedora (native)
b. Command:
./caddy run
d. My complete Caddy config:
http://localhost:7777 {
reverse_proxy some.backend.com {
header_up Host {upstream_hostport}
}
header {
Set-Cookie "PHPSESSID={http.request.cookie.PHPSESSID}; path=/; SameSite=None; Secure;"
}
}
http://localhost:7777 {
reverse_proxy some.backend.com {
header_up Host {upstream_hostport}
}
header {
Set-Cookie {http.request.header.Set-Cookie}{", SameSite=None"}
defer
}
}