So is "rewrite_by_lua" also evil?

agentzh agentzh at
Sun Oct 16 04:17:34 UTC 2011

On Sat, Oct 15, 2011 at 4:41 AM, Nginx User <nginx at> wrote:
> Everything seems to be working fine. However, a small configuration
> error showed a potential problem in that the rewrite_by_lua directive
> does not seem to take account of the rewrite module's "last" flag.

I've just fixed this issue in ngx_lua v0.3.1rc13.

Now running "rewrite a b;" and "rewrite a b last;" will cause
rewrite_by_lua and rewrite_by_lua_file (as well as others) to skip

But please note that, only location rematch (or location re-lookup)
triggered by ngx_rewrite's "rewrite" directive (or anything else) will
skip rewrite phase Lua code. It has nothing to do with rewrite
directive's "last" modifier. So "rewrite a b break" will not skip
rewrite-phase Lua handlers just because no location re-lookup will
follow it.

The location rematch (or re-lookup) behavior of the "rewrite"
directive is kinda like internal redirection, but not the same.

BTW, ngx_openresty devel release already includes this version
of ngx_lua :)


More information about the nginx mailing list