Welcome! Log In Create A New Profile

Advanced

Re: variable variables?

agentzh
January 03, 2012 12:20AM
On Mon, Jan 2, 2012 at 11:40 PM, Karoly Negyesi <chx1975@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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

variable variables?

Karoly Negyesi January 02, 2012 10:42AM

Re: variable variables?

agentzh January 03, 2012 12:20AM

Re: variable variables?

agentzh January 03, 2012 12:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 122
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready