Hello!
On Thu, Sep 25, 2014 at 9:48 AM, kamalp wrote:
> I want to get location directive value in lua script . I know i can get
> in Uri but still i need to get value.
>
> Is it possible ? please let me know.
>
Do you mean for the following configuration
location = /foo {
...
}
you want to fetch the string "= /foo" from within your Lua code?
Yes, it's technically possible but ngx_lua does not provide an API
yet. I think this is worth adding an "ngx.config.location()" API
function. Will you provde a patch? Basically the implementation should
look something like this (pseudo C code, just to demonstrate the basic
idea):
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
return string_concat(clcf->noname ? "*" : (clcf->exact_match ? "="
: ""), &clcf->name)
See the ngx_http_core_find_config_phase function in the nginx C for
more details.
Regards,
-agentzh