-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more_set_headers and manipulating single cookie #18
Comments
@rahul286 You're recommended to use the ngx_lua module to do this, which is much more flexible and also easier. Below is a tested example for your example above:
The only bit that deserves some explanation is that See ngx_lua's documentation for more details: https://github.com/chaoslawful/lua-nginx-module#readme |
@agentzh Thanks for your help an Lua code. I am aware of Lua module and possibilities with it. There are few reasons I wanted to do it using headers-more-nginx-module
By the way, after posting this issue, I got my app working with headers-more module as well. Basically, I divided app in cached and non-cached zones. In cached zone, clearing all cookies did not hurt. I will explore Lua soon as it looks like a magical solution to many different problems. Our of curiosity, may I know if this will be resolved in headers-more-nginx-module as well? I somehow feel this is more like a bug (or side-effect). Apart from cookies, there might be some extended headers with repetition. So if goal is to manipulate only one-line then removing other lines with same header-keys may not be expected behavior. Thanks. |
Hello! On Sun, Oct 27, 2013 at 11:11 PM, Rahul Bansal [email protected] wrote:
Seems like we need to set up a PPA for OpenResty :)
But you need to add such logic as C code anyway. Also, you can also
'require("override_cookie").set("target-cookie", "myvalue")'; Not bad at all, isn't it? ;)
You definitely should ;) We created ngx_lua just because we didn't
It requires patching ngx_headers_more.
No, it's not a bug. It's the expected behavior by design.
It may not. But it's the current behavior by design. I don't mind Best regards, |
Loos like there is already one - https://launchpad.net/~miurahr/+archive/openresty :-)
It's really nice. It just pushed Lua to the top of my TO-DO list. Most likely this weekend I will nail it. :-)
Last time I coded in C was back in 2006 for college assignment as student. I will definitely explore Lua for this and many other complex problems I am trying to handle at Nginx level. But whenever we have a C programmer free for a day in team (in future), patching this module (in clean and intuitive way, with documentation) will help some people. I strongly feel, most admins who want to use this module for cookies-modifications will be expecting an option or flag to control if a single cookie gets affected or all. Thanks again. |
Should this be closed now that multiple headers can be appended? c.f. #141 |
@agentzh
I'm trying to solve a problem and this module is very close to intended workaround.
Backend app sets number of cookies and I need to alter value of a cookie in certain circumstances.
When I do:
more_set_headers "Set-Cookie: target-cookie=myvalue";
It does changes
target-cookie
's value but it removes other "Set-cookie" header from output.My intention is to change value for
target-cookie
only without touching other cookies.May I know is there any workaround for this? Or this can rectified by patching module itself?
Thanks.
The text was updated successfully, but these errors were encountered: