set $cookie_abc "$cookie_abc";

amodpandey nginx-forum at nginx.us
Mon Feb 11 09:49:46 UTC 2013


I have some lua code where I play with the value of ngx.var.cookie_abc. The
variable must exist if some assignment is done on it.

To achieve this I did

set $cookie_abc "$cookie_abc";

The above line clears the value of $cookie_abc, where in I assumed it to be
defaulted if the value already exists.

i.e. if request has cookie abc="test" set, the $cookie_abc will have value
test. But after executing the above expression the value is set to blank "".
Where in it should have been "test". If the cookie value is not present in
the request then obviously the value should be blank.

Is there a way around it? If not, can it be fixed.

Note even this won't work

set $tmp_abc "$cookie_abc";
set $cookie_abc "$tmp_abc";

There variable values are referential so even $tmp_abc become blank.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,236075,236075#msg-236075



More information about the nginx mailing list