So is "rewrite_by_lua" also evil?

Nginx User nginx at nginxuser.net
Sat Oct 15 08:46:14 UTC 2011


On 15 October 2011 09:36, agentzh <agentzh at gmail.com> wrote:
> Interesting. But I cannot reproduce this issue with the following
> small example on my side:
>
>    location @pretty {
>        rewrite ^/main/xyz\.html$ /abc.html last;
>        rewrite_by_lua 'ngx.exec("@proxy")';
>    }
>    location @proxy {
>        echo hello;
>    }
>    location /abc.html {
>        echo abc;
>    }
>    location /main {
>        try_files $uri $uri/ @pretty;
>    }
>
> Then GET /main/xyz.html yields the output "abc" as expected and I
> don't see that ngx_lua error message in my error.log.
>
> Could you show me the error.log with --with-debug + debug log level?


http://pastebin.com/estie4W8

# GET /forum/
server {
  root /home/user/testsite.com/public_html/test_app
  ...
  location @pretty_urls {
       # A number of rewrite rule. Hit line replicated
       ...
       rewrite ^/(abc|forum|xyz)/?$ "/index.php?pretty;action=$1" last;
       ...

       rewrite_by_lua 'ngx.exec("@proxy");';
  }
  location @proxy {
      include /etc/nginx/firewall.default;
      proxy_pass http://127.0.0.1:8080;
      ...
  }
  location ~ ^.+\.php$ {
      rewrite_by_lua 'ngx.exec("@proxy");';
  }
  location / {
      try_files $uri $uri/ @pretty_urls;
  }
}



More information about the nginx mailing list