Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

set $cookie_abc "$cookie_abc"; (8 replies)

$
0
0
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.

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>