# QNs about cookies and caching

**URL:** <https://www.ruby-forum.com/t/qns-about-cookies-and-caching/227147>\
**Category:** NGINX\
**Created:** [March 5, 2013, 8:06pm UTC](https://www.ruby-forum.com/t/qns-about-cookies-and-caching/227147 "2013-03-05T20:06:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bodikp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e79b87/32.png) [@bodikp](https://www.ruby-forum.com/u/bodikp)\
**Post date:** [March 5, 2013, 8:06pm UTC](https://www.ruby-forum.com/t/qns-about-cookies-and-caching/227147/1 "2013-03-05T20:06:39Z")

</div>

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?

Peter

Sent from my iPhone
