см. Коды ниже:
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
Проблемы во 2-м случае: 1. echo $ RUN_VERSION;ничего не показывает2. Предполагалось отобразить 11111