lundi 23 septembre 2019

vars not working after rewrite_by_lua_block

see the codes below:

set $RUN_VERSION 'current';
rewrite_by_lua_block {
    ....
    ngx.var.RUN_VERSION = 'new'
}
echo $RUN_VERSION;
--------------------
visit the server: new
It seems work.

========================================================

set $RUN_VERSION 'current';
rewrite_by_lua_block {
    ....
    ngx.var.RUN_VERSION = 'new'
}
echo $RUN_VERSION;

if ($RUN_VERSION = "new"){
    echo "11111";
}
if ($RUN_VERSION = "current"){
    echo "22222";
}
--------------------
visit the server: 22222

Problems in the 2nd case: 1. echo $RUN_VERSION; shows nothing. 2. It was supposed to display 11111

Aucun commentaire:

Enregistrer un commentaire