I would like to assign the value to the nginx variable.
This is my sample code.
location / {
set $TOKEN;
content_by_lua_block {
result = io.popen("echo 'https://google.com'") # or any command that will return value to result
ngx.var.TOKEN = result:read()
}
proxy_pass ${TOKEN};
Do anyone have idea about it?
Use set_by_lua_block: