So is "rewrite_by_lua" also evil?

agentzh agentzh at
Sat Oct 15 09:40:11 UTC 2011

On Sat, Oct 15, 2011 at 4:46 PM, Nginx User <nginx at> wrote:
> # GET /forum/
> server {
>  root /home/user/
>  ...
>  location @pretty_urls {
>       # A number of rewrite rule. Hit line replicated
>       ...
>       rewrite ^/(abc|forum|xyz)/?$ "/index.php?pretty;action=$1" last;

Okay, I must say that ngx_rewrite's "last" won't affect rewrite_by_lua
because rewrite_by_lua is not part of that module (and there's no
known way to achieve that).

So it's recommended to do URL rewrite all in rewrite_by_lua. Some
people has pointed out that ngx.exec() is a little heavy as compared
to ngx_rewrite's rewrite directive. I may implement an ngx.rewrite()
function for ngx_lua in the near future and it's an easy hack :)

But set_by_lua will be affected because that directive is injected
into ngx_rewrite's instruction list by means of ngx_devel_kit's
set_var submodule.


More information about the nginx mailing list