Filtering backend set-cookie


Is there a way to filter the cookies set by backend on a caching

What I need is to be able to cache on frontend even if some cookies are
If I do proxy_ignore_headers: Set-Cookie than all cookies will be
ignored on
frontend and page will be cached regardless of what cookie backend sets.

I cannot control the backend, that’s why I need to do it on frontend.

I’ve tried using $upstream_http_set_cookie but it contains only one
the first cookie.

So, if the upstream responds with in this order:
Set-Cookie: some_cookie=one
Set-Cookie: another_cookie=two
Set-Cookie: third_cookie=three

$upstream_http_set_cookie will contain ‘some_cookie=one’