QNs about cookies and caching

I’m wondering if someone can help with the following? I have a java app
where I’m using nginx as a caching reverse proxy. I have a location
defined for five distinct JSPs and different cache configurations and
custom keys for each. Some locations are using:
proxy_ignore_headers Set-Cookie
Proxy_pass_header off
proxy_hide_header Set-Cookie

To ensure that responses that set cookies can be safely cached without
returning responses that set cookies.

Any of these JSPs could possibly create a backend session if the client
doesn’t pass a jsessionid cookie.

I’d really like to get a different behavior whereby if a response from
the backend includes a Set-Cookie then the response is cached without
the Set-Cookie but the original caller does see the Set-Cookie header.
Is this possible with some lua or other trickery?


Sent from my iPhone