Good day guys,
I'm using access_by_lua_block on a proxy server to check incoming credentials and I would like to forward resulting user to the backend. I see that most examples declare nginx var, set it in Lua, then use it in proxy_set_header.
Is there a way to set proxy headers directly from lua?
E.g. instead of:
location / {
set $user "";
access_by_lua_block {
ngx.var.user = "foo"
}
proxy_set_header X-Forwarded-User $user;
proxy_pass ...
}
Something like:
location / {
access_by_lua_block {
ngx.proxy.set_header("X-Forwarded-User", "foo")
}
proxy_pass ...
}
Thanks in advance,
Zaar