variable variables?
agentzh
agentzh at gmail.com
Tue Jan 3 05:19:19 UTC 2012
On Mon, Jan 2, 2012 at 11:40 PM, Karoly Negyesi <chx1975 at gmail.com> wrote:
> Hi,
>
> Nginx provides the value of the cookie "foo" in $cookie_foo . Is it
> possible to read "foo" from the URL? In PHP you would use two dollar
> signs for this kind of indirection.
>
Well, it is trivial with ngx_lua's set_by_lua config directive:
location /blah {
set_by_lua $arg_value
'local arg_name = ngx.var.cookie_foo
return ngx.var["arg_" .. arg_name]';
# reference $arg_value in later phase config directives here...
}
See the documentation for details:
http://wiki.nginx.org/HttpLuaModule#set_by_lua
Regards,
-agentzh
More information about the nginx
mailing list