Advise to develop a rights-control module
agentzh at gmail.com
Tue Sep 20 00:24:42 UTC 2011
On Mon, Sep 19, 2011 at 11:25 PM, Legrand Jérémie
<jeremie.legrand at atos.net> wrote:
> Thanks for your answers.
> I studied the lua_module which is great but didn't feet my needs. My validation rule is quite complicated and could not be developed only with lua.
I've said that you could implement your validation rule in a custom
Lua C module in the form of a .so or .dynlib file and just "require"
that C library from within Lua. You can take my lua-redis-parser
library for an example:
> Just one comment about this module. Why it is not possible to use ngx.location.capture in set_by_lua directive ? It would be very helpful !
It's limited by how the standard ngx_rewrite module is implemented.
The ngx_rewrite module does not allow I/O interruptions in the process
of running its instructions. You can work around this by setting Nginx
variable values from within rewrite_by_lua/access_by_lua. Here's a
real-world example for this:
> Finally, I achieved my goal by sending an ngx_http_send_response from my module and setting request keep_alive to 0. It works. Do you think this solution is ok ?
No, it's logically wrong. You should return NGX_HTTP_OK from within
your own access phase handler after sending out your response headers
More information about the nginx-devel