Welcome! Log In Create A New Profile

Advanced

Selectively implement something like proxy_ignore_headers Set-Cookie?

Peter Booth
March 08, 2013 12:05PM
I'm wondering if anyone has any thoughts about how I might address the
following?



I am using nginx as a caching reverse proxy in front of a complex
Apache/Weblogic Java application.

I have a half-dozen Location blocks that have different caching policies
with custom keys and

different cache lifetimes. I'm using openresty to implement different
cache key logic with lua scripts

and until now everything has gone smoothly.



Some of the locations use the combination of



proxy_ignore_headers Set-Cookie and proxy_hide_header Set-Cookie to
strip cookies from cached responses.



Another location needs to allow for session cookies to be created and so
it has the default nginx behavior of not caching

responses that contain cookies.



Now I need a different hybrid behavior-



if a response contains "Set-Cookie: TLTHID", then strip it from the
response, but still cache the response.

If the response contains any other Set-Cookie header then don't cache
the response.



I have tried to use more_clear_headers 'Set-Cookie: TLTHID*" to strip
the cookie and I see

that it does indeed remove the cookie from the response, however the
debug log shows me that the object is still

seen as being not cacheable, presumably because nginx knows that the
stripped Set-Cookie was there.

Is there an easy way to work around this? I'd considered running a
second nginx process to simply act as a

proxy that strips the 'Set-Cookie: TLTHID*" header - it sounds clunky
but I expect it would work.





Is there a way to achieve this within a single nginx instance?

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Selectively implement something like proxy_ignore_headers Set-Cookie?

Peter Booth March 08, 2013 12:05PM

Re: Selectively implement something like proxy_ignore_headers Set-Cookie?

Jonathan Matthews March 08, 2013 01:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 301
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready