After this Posts Reverse Proxy Cookie Set and Read
I tried to replace header_downstream Set-Cookie 'SESSION={~SESSION}'
is not work.
Caddy’s Placeholder {~cookie} not support response.
And Caddy-Filter can’t replace Header content,only Content Body.
so,I tried to modify caddy or caddy-filter.add some featrue like that.
But,I found that seems not be easy.
example
echocat/caddy-filter/filter.go Line 63
bodyRetrieved := false
for _, rule := range instance.rules {
if rule.matches(request, &header) {
if !bodyRetrieved {
body = wrapper.recordedAndDecodeIfRequired()
bodyRetrieved = true
}
body = rule.execute(request, &header, body)
}
if rule.matchesSetCookie(request, &header) {
// is match Set-Cookie
oldHeader := wrapper.Header().Get("Set-Cookie")
}
}
I wanna add matchsSetCookie
function.
wrapper.Header().Get()
Only get a value?not return array.But,Set-Cookie
header always had a lot.
I cant get all values of Set-Cookie
,so I cant finished it.
How can i do that.